Transactional memory that performs a tcam 32-bit lookup operation

ABSTRACT

A transactional memory (TM) receives a lookup command across a bus from a processor. The command includes a memory address. In response to the command, the TM pulls an input value (IV). The memory address is used to read a word containing multiple result values (RVs), multiple reference values, and multiple mask values from memory. A selecting circuit within the TM uses a starting bit position and a mask size to select a portion of the IV. The portion of the IV is a lookup key value (LKV). The LKV is masked by each mask value thereby generating multiple masked values. Each masked value is compared to a reference value thereby generating multiple comparison values. A lookup table generates a selector value based upon the comparison values. A result value is selected based on the selector value. The selected result value is then communicated to the processor via the bus.

TECHNICAL FIELD

The described embodiments relate generally to network processorintegrated circuits employing transactional memories and to relatedmethods.

BACKGROUND INFORMATION

A network processor is a device that executes programs to handle packettraffic in a data network. A network processor is also often referred toas a network flow processor or simply a flow processor. Examples includenetwork processor integrated circuits on router line cards and in othernetwork equipment. In one example, a network processor integratedcircuit is capable of receiving packets, classifying and performingatomic operations on the packets and associated packet data, andtransmitting packets. Processors on the integrated circuit are calledupon to perform processing functions that include using hash functionsand hash tables stored in on-chip memories to find data structures thatstore information pertaining to different types of packets. A processoron the integrated circuit may also be called upon to determine and tolog updated packet count and byte count information into appropriatetables in memory. As throughput requirements increase, ways of addingprocessing power are sought.

In one specific example, a network processor integrated circuit uses theflexible and expandable IXP2800 architecture. The IXP2800 architectureallows multiple high-speed processors (referred to as microengines) toaccess the same memory resources via a common command/push/pull bus. Dueto use of the IXP2800 architecture and multiple microengines, increasedprocessing power is brought to bear on the tasks of identifying datastructures using hash functions and of logging packet and byte countinformation. If more throughput is required, then more microengines canbe employed. If less throughput is required, then fewer microengines canbe employed. The NFP-3XXX and NFP-6XXX families of network processorintegrated circuits available from Systems, Inc. of Santa Clara, Calif.include a selection of IXP2800-based network processor integratedcircuits having different numbers of microengines.

SUMMARY

An Island-Based Network Flow Processor (IB-NFP) includes a plurality ofislands that are interconnected by a configurable mesh Command/Push/Pull(CPP) data bus. A first of the islands includes a processor. A second ofthe islands includes a novel transactional memory. The CPP data busincludes a configurable command mesh, a configurable pull-id mesh, aconfigurable data0 mesh, and a configurable data1 mesh.

In a first novel aspect, the processor on the first island sends a TCAM32-bit lookup command across the command mesh of the CPP data bus to thenovel transactional memory of the second island. The lookup commandincludes a memory address. A memory unit of the transactional memorystores a plurality of result values, a plurality of reference values,and a plurality of mask values in a corresponding set of memorylocations. A state machine within a hardware engine of the transactionalmemory receives the lookup command and in response performs a pull usingother meshes of the CPP data bus thereby obtaining an input value (IV).The memory address is used to generate a read request that iscommunicated to the memory unit from the hardware engine. In response tothe read request, the memory unit sends two words including a startingbit position value, a mask size value, multiple result values, multiplereference values, and multiple mask values to the hardware engine. Thehardware engine uses the starting bit position value and mask size valueto select a portion of the IV. The portion of the input value is thelookup key value. The lookup key value is masked by each masking valuethereby generating multiple masked lookup key values. Each masked lookupkey value is compared to one reference value thereby generating multiplecomparison values. A selector value is determined based upon themultiple comparison values. One result value is selected based on thedetermined selector value. The state machine causes the result value tobe communicated back to the processor. To carry out the lookupoperation, there is only one bus transaction value sent across thecommand mesh of the CPP data bus.

In one specific example, the circuitry of the transactional memoryincludes a lookup engine, a memory unit, and a data bus interface. Thelookup engine in turn includes a state machine selector, a state machinearray including multiple state machines, an arbiter, a translator, aregister pool, and a pipeline. The memory unit includes a memory, inputFIFOs, output FIFOs, and a pair of crossbar switches. The starting bitposition value, the mask size value, the result values, and the maskvalues are stored in a corresponding set of memory locations in thememory.

When the transactional memory receives a TCAM 32-bit lookup command, thecommand passes through the data bus interface and to the state machineselector of the lookup engine. The state machine selector selects one ofthe state machines of the state machine array that is idle. The statemachine selected then transitions operation from the idle state to apull state. A pull occurs across the CPP data bus so that an input valueis read back across the CPP data bus and is stored in the register pool.The state machine transitions from the pull state to the output state.This results in the state machine outputting an operation instruction.The state machine transitions from the output state to the wait forresult state. The operation instruction is translated by the translatorinto address information and a set of op codes. The set of op codesincludes one op code for each of the stages of the pipeline. After thepipeline has performed each op-code a final result value is communicatedto the initiating state machine, the state machine cause the resultvalue to be communicated to the processor, and the state machinetransitions to the idle state.

A first stage of the pipeline, as determined by its op code, issues aread request, including a memory address value, to the memory unit. Theread request is serviced by a memory controller of the memory unit. Thememory unit returns the requested contents of the memory location. Inone example, the content is two memory words containing multiple resultvalues, multiple reference values, and multiple mask values. Anotherstage of the pipeline, as determined by its op code, performs a lookupoperation, thereby determining a lookup key value and a selector valueused to select one result value. A subsequent stage in the pipeline, asdetermined by its op code, then communicates the selected result valueto the initiating state machine. The state machine communicates theresult value to the processor.

There is only one pipeline, use of which is shared by the several statemachines of the state machine array. Multiple state machines can beusing the pipeline at the same time. The state machines and the pipelineare dedicated hardware circuits and involve no processor that fetchesinstructions, decodes the instructions, and executes the instructions.The lookup engine is not limited to performing TCAM 32-bit lookupoperations, but rather is usable to perform many other types of lookupoperations. The example of using the lookup engine to perform a TCAM32-bit lookup operation is presented just as one operation that thelookup engine can perform.

In a second novel aspect, the processor on the first island sends a PMM32-bit lookup command across the command mesh of the CPP data bus to thenovel transactional memory of the second island. The lookup commandincludes a memory address. A memory unit of the transactional memorystores a plurality of result values, a plurality of reference values,and a plurality of prefix values in a corresponding set of memorylocations. A state machine within a hardware engine of the transactionalmemory receives the lookup command and in response performs a pull usingother meshes of the CPP data bus thereby obtaining an input value (IV).The memory address is used to generate a read request that iscommunicated to the memory unit from the hardware engine. In response tothe read request, the memory unit sends two words including a startingbit position value, a mask size value, multiple result values, multiplereference values, and multiple prefix values to the hardware engine. Thehardware engine uses the starting bit position value and mask size valueto select a portion of the IV. The portion of the input value is thelookup key value. Each prefix value is used to generate a mask value.The lookup key value is masked by each masking value thereby generatingmultiple masked lookup key values. Each masked lookup key value iscompared to one reference value thereby generating multiple comparisonvalues. A selector value is determined based upon the multiplecomparison values. One result value is selected based on the determinedselector value. The state machine causes the result value to becommunicated back to the processor. To carry out the lookup operation,there is only one bus transaction value sent across the command mesh ofthe CPP data bus.

In one specific example, the circuitry of the transactional memoryincludes a lookup engine, a memory unit, and a data bus interface. Thelookup engine in turn includes a state machine selector, a state machinearray including multiple state machines, an arbiter, a translator, aregister pool, and a pipeline. The memory unit includes a memory, inputFIFOs, output FIFOs, and a pair of crossbar switches. The starting bitposition value, the mask size value, the result values, and the prefixvalues are stored in a corresponding set of memory locations in thememory.

When the transactional memory receives a PMM 32-bit lookup command, thecommand passes through the data bus interface and to the state machineselector of the lookup engine. The state machine selector selects one ofthe state machines of the state machine array that is idle. The statemachine selected then transitions operation from the idle state to apull state. A pull occurs across the CPP data bus so that an input valueis read back across the CPP data bus and is stored in the register pool.The state machine transitions from the pull state to the output state.This results in the state machine outputting an operation instruction.The state machine transitions from the output state to the wait forresult state. The operation instruction is translated by the translatorinto address information and a set of op codes. The set of op codesincludes one op code for each of the stages of the pipeline. After thepipeline has performed each op-code a final result value is communicatedto the initiating state machine, the state machine cause the resultvalue to be communicated to the processor, and the state machinetransitions to the idle state.

A first stage of the pipeline, as determined by its op code, issues aread request, including a memory address value, to the memory unit. Theread request is serviced by a memory controller of the memory unit. Thememory unit returns the requested contents of the memory location. Inone example, the content is two memory words containing multiple resultvalues, multiple reference values, and multiple prefix values. Anotherstage of the pipeline, as determined by its op code, performs a lookupoperation, thereby determining a lookup key value and a selector valueused to select one result value. A subsequent stage in the pipeline, asdetermined by its op code, then communicates the selected result valueto the initiating state machine. The state machine communicates theresult value to the processor.

There is only one pipeline, use of which is shared by the several statemachines of the state machine array. Multiple state machines can beusing the pipeline at the same time. The state machines and the pipelineare dedicated hardware circuits and involve no processor that fetchesinstructions, decodes the instructions, and executes the instructions.The lookup engine is not limited to performing PMM 32-bit lookupoperations, but rather is usable to perform many other types of lookupoperations. The example of using the lookup engine to perform a PMM32-bit lookup operation is presented just as one operation that thelookup engine can perform.

Further details and embodiments and techniques are described in thedetailed description below. This summary does not purport to define theinvention. The invention is defined by the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, where like numerals indicate like components,illustrate embodiments of the invention.

FIG. 1 is a top-down diagram of an Island-Based Network Flow Processor(IB-NFP) integrated circuit 1 and associated memory circuits 2-7 in anMPLS router application.

FIG. 2 shows the Command-Push-Pull (CPP) data bus structure thatinterconnects functional circuitry in the islands of FIG. 1.

FIG. 3 is diagram of a bus transaction value communicated across the CPPdata bus.

FIG. 4 is a table listing the parts of the command payload of the bustransaction value of FIG. 3, when the bus transaction value is a commandsent across the command mesh of the CPP data bus.

FIG. 5 is a table listing the width and description of each field withinthe payload of a bus transaction value sent across the pull-id mesh ofthe CPP data bus.

FIG. 6 is a table listing the width and description of each field withinthe payload of a bus transaction value sent across the data0 or data1mesh of the CPP data bus.

FIG. 7 is a table listing the width and description of each field withinthe data payload of a pull transaction.

FIG. 8 is a table listing the width and description of each field withinthe data payload of a push transaction.

FIG. 9 is a simplified diagram of microengine (ME) island 40 of theIB-NFP integrated circuit of FIG. 1.

FIG. 10 is a simplified diagram of the memory unit (MU) half island 42and memory unit (MU) block 52 of the IB-NFP integrated circuit of FIG.1.

FIG. 11 is a diagram showing further detail of the atomic engine in theMU half island and block of FIG. 10.

FIG. 12 is a diagram showing further detail of the Dcache (memory unit)in the MU half island and block of FIG. 10.

FIG. 13 is a diagram showing further detail of the data structure tablestored in the Dcache 76 of FIG. 12.

FIG. 14 is a timing diagram showing actions that occur during a carryingout of an Atomic Look-up, Add and Lock command.

FIG. 15 is a diagram illustrating the contents of an ethernet packet.

FIG. 16 is a state diagram illustrating the different states of one ofthe state machines within the atomic engine.

FIG. 17 is a simplified diagram of the register pool within the MU halfisland and block.

FIG. 18 is a more detailed diagram of the pipeline showing the contentsof each FIFO and register within the atomic engine of the MU half islandand block.

FIG. 19 is a diagram illustrating the contents of a hash bucket.

FIG. 20 is a more detailed diagram of the Look-Up stage within thepipeline of the atomic engine of the MU half island and block.

FIG. 21 is a table listing the width and description of each fieldwithin a results packet.

FIGS. 22A and 22B are a flowchart of describing the operation of atransactional memory in response to an Atomic Look-up, Add, and Lockcommand.

FIG. 23 is a diagram showing action arrows that correspond to each stepdescribed in the flowchart of FIGS. 22A and 22B.

FIG. 24 is a detailed operational flowchart of the pipeline within theatomic engine of the MU half island and block 42, 52 of the IB-NFPintegrated circuit of FIG. 1.

FIG. 25 (Prior Art) is a diagram of a transactional memory performing acount update.

FIG. 26 is a detailed diagram of the stats engine within the MU halfisland and block 42, 52 of the IB-NFP integrated circuit of FIG. 1.

FIG. 27 is a state diagram of one of the state machines within the statsengine of FIG. 26.

FIG. 28 is flowchart illustrating the operation of the pipeline withinthe stats engine in response to receiving an Add and Update command.

FIG. 29 is a flowchart of a method involving a novel hardware triestructure.

FIG. 30 is a diagram of a router that carries out the method of FIG. 29.

FIG. 31 is a diagram showing a lookup engine within an MU island infurther detail.

FIG. 32 is a state diagram for a state machine of the lookup engine ofFIG. 31.

FIG. 33 is a block diagram of the lookup stage of the pipeline withinthe lookup engine of FIG. 31.

FIG. 34 is a diagram of a 3×128-bit block of information (stored in thememory of the transactional memory) that configures the hardware triestructure in the lookup stage of the lookup engine of FIG. 31.

FIG. 35 is a circuit diagram of the barrel shifter in the lookup engineof FIG. 31.

FIG. 36 is a circuit diagram of the hardware trie structure in thelookup stage of the lookup engine of FIG. 31.

FIG. 37 is a conceptual diagram of the operation of the hardware trielookup structure.

FIG. 38 is a diagram that shows the various parts of a result value asoutput by the hardware trie structure.

FIG. 39 is a detailed diagram of the lookup engine within an MU islandperforming a direct 32-bit lookup operation.

FIG. 40 is a diagram of the direct 32-bit lookup memory packing scheme.

FIG. 41 is a circuit diagram of the request stage of the pipeline withinthe lookup engine of FIG. 39.

FIG. 42 is a circuit diagram of the lookup stage of the pipeline withinthe lookup engine of FIG. 39.

FIG. 43 is a diagram of a direct 32-bit result value.

FIG. 44 is a flowchart of a method involving a novel hardware direct32-bit lookup operation.

FIG. 45 is a flowchart of a method 7000 in accordance with another novelaspect.

FIG. 46 is a detailed diagram of the lookup engine within an MU islandperforming a direct 24-bit lookup operation.

FIG. 47 is a diagram of the direct 24-bit lookup memory packing scheme.

FIG. 48 is a circuit diagram of the request stage of the pipeline withinthe lookup engine of FIG. 46.

FIG. 49 is a circuit diagram of the lookup stage of the pipeline withinthe lookup engine of FIG. 46.

FIG. 50 is a flowchart of a method involving a novel hardware direct24-bit lookup operation.

FIG. 51 is a detailed diagram of the lookup engine within the MU islandperforming a TCAM 32-bit lookup operation.

FIG. 52 is a diagram of the TCAM 32-bit lookup memory packing scheme.

FIG. 53 is a circuit diagram of the lookup stage of the pipeline withinthe lookup engine of FIG. 51.

FIG. 54 is a table illustrating the TCAM 32-bit lookup operation.

FIG. 55 is a flowchart of a method involving a novel hardware TCAM32-bit lookup operation.

FIG. 56 is a detailed diagram of the lookup engine within the MU islandperforming an PMM 32-bit lookup operation.

FIG. 57 is a diagram of the PMM 32-bit lookup memory packing scheme.

FIG. 58 is a table illustrating the PMM 32-bit lookup operation.

FIG. 59 is a circuit diagram of the lookup stage of the pipeline withinthe lookup engine of FIG. 56.

FIG. 60 is a table illustrating an example of prefix value to mask valuemapping.

FIG. 61 is a flowchart of a method involving a novel hardware PMM 32-bitlookup operation.

DETAILED DESCRIPTION

Reference will now be made in detail to background examples and someembodiments of the invention, examples of which are illustrated in theaccompanying drawings. In the description and claims below, relationalterms such as “top”, “down”, “upper”, “lower”, “top”, “bottom”, “left”and “right” may be used to describe relative orientations betweendifferent parts of a structure being described, and it is to beunderstood that the overall structure being described can actually beoriented in any way in three-dimensional space.

FIG. 1 is a top-down diagram of an Island-Based Network Flow Processor(IB-NFP) integrated circuit 1 and associated memory circuits 2-7 in anMPLS router application. IB-NFP integrated circuit 1 includes many I/O(input/output) terminals (not shown). Each of these terminals couples toan associated terminal of the integrated circuit package (not shown)that houses the IB-NFP integrated circuit. The integrated circuitterminals may be flip-chip microbumps and are not illustrated.Alternatively, the integrated circuit terminals may be wire bond pads.

SerDes circuits 9-12 are the first set of four SerDes circuits that areused to communicate with an external network via optical cables. SerDescircuits 13-16 are the second set of four SerDes circuits that are usedto communicate with a switch fabric (not shown) of the router. Each ofthese SerDes circuits 13-16 is duplex in that it has a SerDes connectionfor receiving information and it also has a SerDes connection fortransmitting information. Each of these SerDes circuits can communicatepacket data in both directions simultaneously at a sustained rate of 25Gbps. IB-NFP integrated circuit 1 accesses external memory integratedcircuits 2-7 via corresponding 32-bit DDR physical interfaces 17-22,respectively. IB-NFP integrated circuit 1 also has several generalpurpose input/output (GPIO) interfaces. One of these GPIO interfaces 23is used to access external PROM 8.

In addition to the area of the input/output circuits outlined above, theIB-NFP integrated circuit 1 also includes two additional areas. Thefirst additional area is a tiling area of islands 24-48. Each of theislands is either of a full rectangular shape, or is half the size ofthe full rectangular shape. For example, the island 29 labeled “PCIE(1)” is a full island. The island 34 below it labeled “ME CLUSTER (5)”is a half island. The functional circuits in the various islands of thetiling area are interconnected by: 1) a configurable meshCommand/Push/Pull (CPP) data bus, 2) a configurable mesh control bus,and 3) a configurable mesh event bus. Each such mesh bus extends overthe two-dimensional space of islands with a regular grid or “mesh”pattern.

In addition to this tiling area of islands 24-48, there is a secondadditional area of larger sized blocks 49-53. The functional circuitryof each of these blocks is not laid out to consist of islands andhalf-islands in the way that the circuitry of islands 24-48 is laid out.The mesh bus structures do not extend into or over any of these largerblocks. The mesh bus structures do not extend outside of island 24-48.The functional circuitry of a larger sized block may connect by directdedicated connections to an interface island and through the interfaceisland achieve connectivity to the mesh buses and other islands.

The arrows in FIG. 1 illustrate an operational example of IB-NFPintegrated circuit 1 within the MPLS router. 100 Gbps packet traffic isreceived onto the router via an optical cable (not shown), flows throughan optics transceiver (not shown), flows through a PHY integratedcircuit (not shown), and is received onto IB-NFP integrated circuit 1,is spread across the four SerDes I/O blocks 9-12. Twelve virtual inputports are provided at this interface. The symbols pass through directdedicated conductors from the SerDes blocks 9-12 to ingress MAC island45. Ingress MAC island 45 converts successive symbols delivered by thephysical coding layer into packets by mapping symbols to octets, byperforming packet framing, and then by buffering the resulting packetsfor subsequent communication to other processing circuitry. The packetsare communicated from MAC island 45 across a private inter-island bus toingress NBI (Network Bus Interface) island 46. In addition to theoptical cable that supplies packet traffic into the IB-NFP integratedcircuit from the router, there is another optical cable thatcommunicates packet traffic in the other direction out of the IB-NFPintegrated circuit and to the router.

For each packet received onto the IB-BPF in the example of FIG. 1, thefunctional circuitry of ingress NBI island 46 examines fields in theheader portion to determine what storage strategy to use to place thepacket into memory. In one example, NBI island 46 examines the headerportion and from that determines whether the packet is an exceptionpacket or whether the packet is a fast-path packet. If the packet is anexception packet then the NBI island determines a first storage strategyto be used to store the packet so that relatively involved exceptionprocessing can be performed efficiently, whereas if the packet is afast-path packet then the NBI island determines a second storagestrategy to be used to store the packet for more efficient transmissionof the packet from the IB-NFP. NBI island 46 examines a packet header,performs packet preclassification, determines that the packet is afast-path packet, and determines that the header portion of the packetshould be placed into a CTM (Cluster Target Memory) in ME (Microengine)island 40. The header portion of the packet is therefore communicatedacross the configurable mesh data bus from NBI island 46 to ME island40. The CTM is tightly coupled to microengines in the ME island 40. TheME island 40 determines header modification and queuing strategy for thepacket based on the packet flow (derived from packet header andcontents) and the ME island 40 informs a second NBI island 37 of these.The payload portions of fast-path packets are placed into internal SRAM(Static Random Access Memory) MU block 52 and the payload portions ofexception packets are placed into external DRAM 6 and 7.

Half island 42 is an interface island through which all informationpassing into, and out of, SRAM MU block 52 passes. The functionalcircuitry within half island 42 serves as the interface and controlcircuitry for the SRAM within block 52. For simplicity purposes in thediscussion below, both half island 42 and MU block 52 may be referred totogether as the MU island, although it is to be understood that MU block52 is actually not an island as the term is used here but rather is ablock. The payload portion of the incoming fast-path packet iscommunicated from NBI island 46, across the configurable mesh data busto SRAM control island 42, and from control island 42, to the interfacecircuitry in block 52, and to the internal SRAM circuitry of block 52.The internal SRAM of block 52 stores the payloads so that they can beaccessed for flow determination by the ME island.

In addition, a preclassifier in the ingress NBI island 46 determinesthat the payload portions for others of the packets should be stored inexternal DRAM 6 and 7. For example, the payload portions for exceptionpackets are stored in external DRAM 6 and 7. Interface island 44,external MU SRAM block 53, and DDR PHY I/O blocks 21 and 22 serve as theinterface and control for external DRAM integrated circuits 6 and 7. Thepayload portions of the exception packets are therefore communicatedacross the configurable mesh data bus from NBI island 46, to interfaceand control island 44, to external MU SRAM block 53, to 32-bit DDR PHYI/O blocks 21 and 22, and to external DRAM integrated circuits 6 and 7.At this point in the operational example, the packet header portions andtheir associated payload portions are stored in different places. Thepayload portions of fast-path packets are stored in internal SRAM in MUblock 52, whereas the payload portions of exception packets are storedin external SRAM in external DRAMs 6 and 7.

ME island 40 informs second NBI island 37 where the packet headers andthe packet payloads can be found and provides the second NBI island 37with an egress packet descriptor for each packet. The egress packetdescriptor indicates a queuing strategy to be used on the packet. SecondNBI island 37 uses the egress packet descriptor to read the packetheaders and any header modification from ME island 40 and to read thepacket payloads from either internal SRAM 52 or external DRAMs 6 and 7.Second NBI island 37 places packet descriptors for packets to be outputinto the correct order. For each packet that is then scheduled to betransmitted, the second NBI island 37 uses the packet descriptor to readthe header portion and any header modification and the payload portionand to assemble the packet to be transmitted. The header modification isnot actually part of the egress packet descriptor, but rather it isstored with the packet header by the ME when the packet is presented tothe NBI. The second NBI island 37 then performs any indicated packetmodification on the packet. The resulting modified packet then passesfrom second NBI island 37 and to egress MAC island 38.

Egress MAC island 38 buffers the packets, and converts them intosymbols. The symbols are then delivered by conductors from the MACisland 38 to the four SerDes I/O blocks 13-16. From SerDes I/O blocks13-16, the 100 Gbps outgoing packet flow passes out of the IB-NFPintegrated circuit 1 and to the switch fabric (not shown) of the router.Twelve virtual output ports are provided in the example of FIG. 1.

General Description of the CPP Data Bus: FIG. 2 shows theCommand-Push-Pull (CPP) data bus structure that interconnects functionalcircuitry in the islands of FIG. 1. Within each full island, the CPPdata bus actually includes four mesh bus structures, each of whichincludes a crossbar switch that is disposed in the center of the island,and each of which includes six half links that extend to port locationsat the edges of the island, and each of which also includes two linksthat extend between the crossbar switch and the functional circuitry ofthe island. These four mesh bus structures are referred to as thecommand mesh bus, the pull-id mesh bus, and data0 mesh bus, and thedata1 mesh bus. The mesh buses terminate at the edges of the full islandsuch that if another identical full island were laid out to be adjacent,then the half links of the corresponding mesh buses of the two islandswould align and couple to one another in an end-to-end collinear fashionto form the staggered pattern illustrated in FIG. 2. For additionalinformation on the IB-NFP, the IB-NFP's islands, the CPP data bus, theCPP meshes, operation of the CPP data bus, and the different types ofbus transactions that occur over the CPP data bus, see: U.S. patentapplication Ser. No. 13/399,433 entitled “Staggered Island Structure inan Island-Based Network Flow Processor” filed on Feb. 17, 2012 (theentire subject matter of which is incorporated herein by reference).

General Description of a Write That Results in a Pull: In one example ofa CPP bus transaction, a microengine (a master) on ME island 40 uses thedata bus interface of ME island 40 to perform a write operation to ahardware engine (a target) on MU half island 42, where the MU island 42responds by performing a pull operation. To do this, the microengine onthe ME island 40 uses the data bus interface to output a bus transactionvalue onto the command mesh of the CPP data bus. The format of the bustransaction value is as set forth in FIG. 3. A bus transaction value 54includes a metadata portion 55 and a payload portion 56 as shown. Themetadata portion 55 includes a final destination value 57 and a validbit 58.

The functional circuitry that receives the bus transaction value and thedata to be written is referred to as the “target” of the writeoperation. The write command is said to be “posted” by the master ontothe command mesh. As indicated in FIG. 3, the write command includes ametadata portion and a payload portion. The metadata portion includesthe 6-bit final destination value. This final destination valueidentifies an island by number, where the island identified is the finaldestination of the bus transaction value. The final destination value isused by the various crossbar switches of the command mesh to route thebus transaction value (i.e., the command) from the master to theappropriate target, in this case to a hardware engine on MU island 42.All bus transaction values on the command mesh that originate from thesame island that have the same final destination value will traversethrough the configurable command mesh along the same one path all theway to the indicated final destination island.

A final destination island may include more than one potential target.The 4-bit target field of payload portion indicates which one of thesetargets in the destination island it is that is the target of thecommand. In the case of MU island 42, this 4-bit field indicates one ofseveral hardware engines of the MU island 42. The 5-bit action field ofthe payload portion indicates that the command is a write. The 14-bitdata reference field is a reference usable by the master to determinewhere in the master the data is to be found. The address field indicatesan address in the target where the data is to be written. The lengthfield indicates the amount of data.

The target (a hardware engine of MU island 42) receives the writecommand from the command mesh and examines the payload portion of thewrite command. From the action field the hardware engine in MU island 42determines that it is to perform a write action. To carry out thisaction, the hardware engine (i.e., posts) a bus transaction value calleda pull-id onto the pull-id mesh. FIG. 3 shows the format of the overallbus transaction value, and FIG. 5 shows the format of the payload. Thefinal destination field of the metadata portion indicates the islandwhere the master (in this case, a microengine on the ME island 40) islocated. The target port field identifies which sub-circuit target it iswithin the target's island that is the target of the command. In thisexample, the target island is the MU island 42 so the sub-circuit is ahardware engine on the MU island. The pull-id is communicated throughthe pull-id mesh back to ME island 40.

The master in the ME island receives the pull-id from the pull-id meshand uses the content of the data reference field of the pull-id to findthe data. In the overall write operation, the master in the ME islandknows the data it is trying to write into the MU island. The datareference value that is returned with the pull-id is used by the masterin the ME island as a flag to match the returning pull-id with the writeoperation the ME had previously initiated.

The master on ME island 40 responds by sending the identified data tothe target on MU island 42 across one of the data meshes data0 or data1as a “pull” data bus transaction value. The term “pull” means that thedata of the operation passes from the master (a microengine on the MEisland) to the target (a hardware engine on the MU island). The term“push” means that the data of the operation passes from the target tothe master. The format of the “pull” data bus transaction value sent inthis sending of data is also as indicated in FIG. 3. The format of thepayload portion in the case of the payload being pull data is as setforth in FIG. 7. The first bit of the payload portion is asserted. Thisbit being a digital high indicates that the transaction is a data pullas opposed to a data push. The target on MU island 42 then receives thedata pull bus transaction value across the data1 or data0 mesh. The datareceived by the hardware engine as the data for the write is the contentof the data field (the data field of FIG. 7) of the pull data payloadportion.

FIG. 6 is a generic description of the data payload, and FIG. 7 is adescription of the data payload when the first bit of the data payloadindicates the data payload is for a pull transaction. FIG. 8 is adescription of the data payload when the first bit of the data payloadindicates that payload is for a push transaction.

General Description of a Read That Results in a Push: In anotherexample, a master (for example, a microengine on ME island 40) uses thedata bus interface of island 40 to perform a read operation from atarget (for example, a hardware engine on MU island 42), where thetarget responds by performing a push operation. The microenginecircuitry in ME island 40 uses the data bus interface of island 40 tooutput (to “post”) a bus transaction value onto the command mesh bus ofthe configurable mesh CPP data bus. In this case, the bus transactionvalue is a read command to read data from the target hardware engine inMU island 42. The format of the read command is as set forth in FIGS. 3and 4. The read command includes a metadata portion and a payloadportion. The metadata portion includes the 6-bit final destination valuethat indicates the island where the target is located. The action fieldof the payload portion of the read command indicates that the command isa read. The 14-bit data reference field is usable by the master as aflag to associate returned data with the original read operation themaster previously initiated. The address field in the payload portionindicates an address in the target where the data is to be obtained. Thelength field indicates the amount of data.

The target (a hardware engine of MU island 42) receives the read commandand examines the payload portion of the command. From the action fieldof the command payload portion the target determines that it is toperform a read action. To carry out this action, the target uses theaddress field and the length field to obtain the data requested. Thetarget then pushes the obtained data back to the master across data meshdata1 or data0. To push the data, the target outputs a push bustransaction value onto the data1 or data0 mesh. FIG. 3 sets forth theformat of the overall push bus transaction value and FIG. 8 sets forththe format of the payload portion of this push bus transaction value.The first bit of the payload portion indicates that the bus transactionvalue is for a data push, as opposed to a data pull. The master (themicroengine of ME island 40) receives the bus transaction value of thedata push from the data mesh bus. The master in the ME island then usesthe data reference field of the push bus transaction value to associatethe incoming data with the original read command, and from the originalread command determines where the pushed data (data in the date field ofthe push bus transaction value) should be written into the master. Themaster then writes the content of the data field into the master'smemory at the appropriate location.

ME Island: FIG. 9 is a diagram of the microengine (ME) island 40. In theoperational flow of FIG. 1, packet headers and the associatedpreclassification results are DMA transferred from the ingress NBIisland 46 across the configurable mesh data bus and into the ClusterTarget Memory (CTM) 59 of ME island 40. A DMA engine in the ingress NBIisland 46 is the master and CTM 59 in ME island 40 is the target forthis transfer. The packet header portions and the associated ingresspacket descriptors pass into the ME island via data bus island bridge 60and data bus interface circuitry 61. Once in the CTM 59, the headerportions are analyzed by one or more microengines. The microengineshave, through the DB island bridge 60, a command out interface, apull-id in interface, a pull-data out interface, and a push data ininterface. There are six pairs of microengines, with each pair sharing amemory containing program code for the microengines. Reference numerals62 and 63 identify the first pair of microengines and reference numeral64 identifies the shared memory. As a result of analysis and processing,the microengines modify each ingress packet descriptor to be an egresspacket descriptor. Each egress packet descriptor includes: 1) an addressindicating where and in which ME island the header portion is found, 2)an address indicating where and in which MU island the payload portionis found, 3) how long the packet is, 4) sequence number of the packet inthe flow, 5) an indication of which queue the packet belongs to (resultof the packet policy), 6) an indication of where the packet is to besent (a result of the packet policy), 7) user metadata indicating whatkind of packet it is.

Memory errors and other events detected in the ME island are reportedvia a local event ring and the global event chain back to the ARM island25. A local event ring is made to snake through the ME island 40 forthis purpose. Event packets from the local event chain are received viaconnections 65 and event packets are supplied out to the local eventchain via connections 66. The CB island bridge 67, the cluster localscratch 68, and CTM 59 can be configured and are therefore coupled tothe control bus CB via connections 69 so that they can receiveconfiguration information from the control bus CB.

MU Island: FIG. 10 is a diagram of MU half island 42 and SRAM block 52.MU half island 42 includes several hardware engines 70-74. In theoperational example, fast path packet payloads are DMA transferreddirectly from ingress NBI island 46 and across the configurable meshdata bus, through data bus interface 75 of half island 42, and into thedata cache SRAM 76 of block 52. The ingress NBI DMA engine issues a bulkwrite command across the configurable mesh data bus to the bulk transferengine 70. The destination is the MU island 42. The action is bulkwrite. The address where the data is to be written into the MU island isthe address taken out of the appropriate buffer list. The bulk writecommand received at the MU is a bulk write, so the data bus interface 75presents the command to the bulk engine 70. The bulk engine 70 examinesthe command which is a write. In order to perform a write the bulkengine needs data, so the bulk engine issues a pull-id through the pullportion of interface 75, which in turn issues a pull-id back onto theconfigurable mesh data bus. The DMA engine in NBI island 46 receives thepull-id. Part of the pull-id is a data reference which indicates to theDMA engine which part of the packet is being requested as data. The DMAengine uses the data reference to read the requested part of the packet,and presents that across the data part of the data bus back to bulkengine 70 in MU island 42. The bulk engine 70 then has the write commandand the packet data. The bulk engine 70 ties the two together, and itthen writes the packet data into SRAM 76 at the address given in thewrite command. In this way, fast path packet payload portions pass fromDMA engine in the ingress NBI island, across the configurable mesh databus, through the data bus interface 75, through a bulk transfer engine70, and into data cache SRAM 76 of block 52. In a similar fashion,exception packet payload portions pass from the DMA engine in ingressNBI island 46, across the configurable mesh data bus, through the databus interface of half island 44, through the bulk transfer engine ofhalf island 44, and through DDR PHYs 21 and 22, and into externalmemories 6 and 6.

Various parts of MU island 42 are configurable by changing the contentsof registers and memory via the control bus CB and connections 77 andcontrol status registers 78. Errors detected on the MU island bycircuits 79 and 80 are reported into a local event ring. Event packetsfrom the local event ring are received via input connections 81 and theMU island outputs event packets to the local even ring via outputconnections 82.

FIG. 11 is a diagram showing the atomic engine 11 and data cache SRAM 76of FIG. 10 in more detail. The MU island 42, 52 is a transactionalmemory. Atomic engine 11 includes a state machine array 84, a statemachine selector 85, a register pool 86, an arbiter 87, a translator 88,and a pipeline 89. Dcache (“Memory Unit”) 76 includes a memory 90, FIFOs91-94, and two cross-bar switches 95 and 96. Memory controller 97manages reads from and writes to the memory. Memory 90 stores a datastructure table 98 and a hash table 99. Data structure table 98 includesa plurality of data structures DS 1-DSN. Hash table 99 includes aplurality of hash buckets HB1-HBN.

FIG. 12 is a more detailed diagram of Dcache (“Memory Unit”) 76. Eachincoming FIFO of a crossbar switch has an associated arbiter. Forexample, arbiter 100 is the arbiter for incoming FIFO 101. Each of thearbiters, such as arbiter 100, receives a separate request signal fromeach of the input FIFOs on the other side of IN crossbar 95. Foradditional information on crossbar switches, their arbiters, and theiroperation, see: U.S. patent application Ser. No. 13/399,433 entitled“Staggered Island Structure in an Island-Based Network Flow Processor”filed on Feb. 17, 2012 (the entire subject matter of which isincorporated herein by reference).

FIG. 13 is a more detailed diagram of the data structure table 98 ofFIG. 12. Each data structure includes four data structure fields: 1) anIP address field for storing an IP address, 2) a number of packets fieldfor storing a number of packets received, 3) a MAC address field forstoring a MAC address, and 4) a timestamp field for storing a timestamp.Data structure DS4 includes IP address field 102, number of packetsreceived field 103, MAC address field 104 and timestamp field 105.

In one example, one of the microengines 160 in ME island 40 receives anethernet packet 106. The contents of ethernet packet 106 are illustratedin FIG. 15. Ethernet packet 106 includes a header 107, a payload 108,and a CRC 109. There is one data structure stored in memory 90 for eachsource address of incoming ethernet packets. Data structure DS4 in thisexample is the data structure for ethernet packets having the sourceaddress 161. A task to be performed is to use to source address 161 ofthe incoming ethernet packet to locate and access the data structureDS4, and then to update the timestamp field 105 in the data structure tolog the time when the ethernet packet was received.

FIG. 14 is a timeline. Events noted in the top line of FIG. 14 indicateactions pertaining to microengine 160 in ME island 40. Events noted inthe bottom line indicate actions pertaining to another microengine inanother ME island. The receiving of the ethernet packet 106 is indicatedat time T1 in the timeline of FIG. 14. In response to receiving thepacket, microengine 160 in ME island 40 uses a hash function tocalculate a hash index 116. The hash index is related to the sourceaddress. In addition, microengine 160 sends an Atomic Lookup, Add andLock (ALAL) command across the Command-Push-Pull (CPP) data bus 159 tothe atomic engine 71 of MU island 42, 52. FIG. 14 shows the sending ofthe ALAL command to occur at time T2. Arrow 110 of FIG. 11 shows theincoming ALAL command. State machine selector 85 monitors the statusindicator of each state machine and allocates the ALAL command 110 to anidle state machine.

FIG. 16 is a state diagram for one of the state machines. Beforereceiving the ALAL command 110 from the state machine selector 85 thestate machine is in the IDLE state 111. Receiving the ALAL commandcauses the state machine to transition from the IDLE state 111 to thePULL state 112. The state machine then causes a PULL bus transactionvalue to be sent via data bus interface 75 back to microengine 160 in MEisland 40. This pull is an instruction to the microengine to write data(the data is a hash key) to the register pool 86 within MU island 42,52.

FIG. 14 shows the sending of the pull command to occur at time T3. Oncethe hash key 137 is received into the register pool, then the statemachine transitions to the OUTPUT state 113. In state 113, the statemachine outputs an operation instruction 114 to arbiter 87. The arbiter87 arbitrates information flow to translator 88. Once the outputoperation is complete the state machine operations transitions fromOUTPUT state 113 to IDLE state 111. Translator 88 converts the operationinstruction 114 into a plurality of OP CODES 115. Part of theinstruction is the hash index 116. Hash index 116 and the OP CODES 115are supplied by the translator 88 to pipeline 89. FIG. 14 shows thesending of the OP CODES and the hash index to the pipeline occurring attime T4. The OP CODES 115 and hash index 116 are pushed into a FIFO 117of request stage 118 of the pipeline. As indicated in FIG. 11, thepipeline includes stages 118-123. Each pipeline stage has an inputregister or FIFO, and an ALU. Reference numeral 124 identifies the inputFIFO of the read stage 119 of the pipeline. Reference numerals 125-128identify the incoming registers for pipeline stages 120-123,respectively. Reference numerals 129-134 identify the ALUs for pipelinestages 118-123, respectively.

Request stage 118 of the pipeline, in response to receiving the OP CODES115 and hash index 116, outputs a hash bucket address 135. The hashbucket address 135 includes the hash index 116, as well as a hash baseidentifier. The hash base identifier indicates one of several possiblehash tables. In the case that only one hash table is utilized, the hashbase identifier is not necessary. FIG. 14 shows the outputting of hashbucket address 135 to read a hash bucket from hash table 99 at time T5.Request stage 118 generates a read request including hash bucket address135. The hash bucket address passes through FIFO 91, and crossbar switch95, to memory controller 97. The hash bucket address is an address thatidentifies one of the hash buckets. The identified hash bucket 136 isreturned via crossbar switch 96 and FIFO 92 to the read stage 119 of thepipeline.

FIG. 17 is a more detailed diagram of register pool 86. Register pool 86includes a controller 139 and a plurality of registers 140. There is oneregister in the register pool for each state machine. Controller 139reads a state machine address 138 out of the last location of the FIFO124 of the read stage 119 of the pipeline, and uses the state machineaddress 138 to identify the associated register. The associated registerstores the hash key 137 that was pulled from the ME island. Controller139 reads the hash key 137 from the appropriate register and suppliesthe hash key 137 to the read stage 119.

FIG. 18 is a more detailed diagram that shows the contents of the FIFOsand registers of the various stages of the pipeline. The hash key 137and the hash bucket 136 pass through ALU and are loaded into register oflookup stage 120.

FIG. 19 is a more detailed diagram of hash bucket 136. Hash bucket 136includes four 32-bit fields. Each 32-bit field includes a hash bucketlocation and an associated lock field. In one example, the hash bucketlocation is 31 bits and the associated lock field if 1 bit. The lockfields are indicated with reference numerals 141-144. The hash bucketlocations are indicated with reference numerals 145-148. Each hashbucket has the identical structure. A hash bucket location may beoccupied in that it stores a hash key, or may be vacant in that it doesnot store a hash key.

FIG. 20 is a diagram that illustrates operation of the lookup stage 120of the pipeline. The OP CODES 115 shown in FIG. 11 include an OP CODEfor each of the stages of the pipeline. The OP CODE 149 for the lookupstage is supplied to the ALU 131 to determine the combinatorial logicfunction performed by the ALU. In the present example, ALU 131 includesfour comparators 150-153. Each comparator compares the contents of acorresponding hash key field of the hash bucket 136 with the hash key137. As indicated in FIG. 20, the hash bucket 136, the OP CODE 149, andthe hash key 137 are supplied to the ALU 131 by the register 125. Eachone of the comparators 150-153 outputs a single digital bit valueindicating whether the corresponding hash bucket entry matched the hashkey 137. The resulting four digital bit values as output by thecomparators are encoded by logic 154 into a two-bit hash bucket locationID value 155 and a one bit found value 156. The hash bucket location IDvalue 155 and the found bit value 156 are loaded into bit locations inthe register 126 of the next stage of the pipeline. If the found bit 156is set then an entry in a hash bucket location matched the hash key 137,whereas if the found bit 156 is not set then no hash bucket locationmatched the hash key 137. If there was a match, then the two-bit hashbucket location ID is a number that identifies one of the four hashbucket locations that had the matching entry. The information stored inthe FIFOs and registers of the various stages is indicated in FIG. 18.Depending on the OP CODES, the various stages perform various operationsand fill in information in a results packet 157. An example of thecontents included in the results packet is illustrated in FIG. 21. FIG.14 shows the lookup operation occurring at time T6.

In this example, the data structure associated with the source addressof ethernet packet 106 was not found. As a result, the add stage 121 ofthe pipeline adds the missing hash key into a vacant hash bucketlocation within the hash bucket. Once the missing hash key has beenadded, the lock stage of the pipeline sets the lock field of the addedhash bucket location, thereby locking the associated data structure.Next, the write stage 123 of the pipeline supplies the results packet157 via data bus interface 75 across the CPP data bus to the initiatingmicroengine 160 on the ME island 40. In addition, the write stage 123 ofthe pipeline generates and communicates a write command including theupdated hash bucket 158 (that contains the added hash key 137) to memorycontroller 97 via FIFO 91. Memory controller 97 writes the updated hashbucket 158 into hash bucket HB1 of the hash table 99. FIG. 14 shows thesupplying of the results packet 157 to the ME island 40 and the updatingof the hash bucket HB1 to be occurring at time T7.

At this point in the process, the data structure DS4 for the sourceaddress of the received packet 106 has been locked and microengine 160has received the results packet 157. From the hash bucket location IDvalue of the results packet 157, the microengine 160 determines thelocation of the data structure DS4. Microengine 160 then performs awrite across the CPP data bus 159, through the bulk engine 70, and tothe timestamp field 105 of data structure DS4. FIG. 14 shows thiswriting of the timestamp to be occurring at time T9 and communication ofa successful write operation at time T10. Microengine 160 can read from,and write to, data structure DS4 as it wishes multiple times. In FIG.14, such reads and writes are indicated to be occurring at times T1-T12.Once microengine 160 no longer needs access to DS4, then microengine 160unlocks DS4 by issuing an atomic command to the atomic engine 71. Theatomic command causes the pipeline to clear the lock field of the hashbucket location associated with DS4. FIG. 14 shows this clearing of thelock field occurring at time T15. After the clearing, the pipelinereturns a results packet to the initiating microengine 160 indicatingthat the associated hash bucket location is unlocked. In FIG. 14, thisreturning of the results packet indicating that the hash bucket locationis unlocked is indicated to occur at time T16.

The ALAL command provides protection against memory contention. This isillustrated in FIG. 14 where a second microengine ME#2 attempts toaccess the same data structure DS4 while the data structure DS4 islocked by microengine 160. In this example, the other microenginereceives the same ethernet packet 106 at time T1, but when it issues itsatomic ALAL command at time T3, the data structure DS4 has already beenlocked. The results packet for the atomic command from the othermicroengine indicates that the data structure DS4 is locked. In FIG. 14,this is indicated to occur at time T8. The second microengine is barredfrom access to DS4 and waits until time T13 to attempt another atomicALAL command to access the same data structure. At time T13, the datastructure is still locked, so at time T14 the returning results packetindicates that the data structure DS4 is still locked. At time T17 theother microengine issues its third atomic command to access DS4. Thistime, DS4 is unlocked due to the unlock command sent by microengine 160at time T15. As a result of the atomic command, at times T18-21 thetransactional memory locks DS4 and returns a results packet at time T22indicating that DS4 is now locked for use by the other microengine. Theoperations performed at times T18-21 correspond to the operationsperformed at times T3-6. The other microengine can then read and writeto the data structure (as indicated to occur at times T23-26). When theother microengine now longer needs access to DS4, the other microenginesends an atomic command to unlock DS4 at time T27.

FIG. 22 is a flowchart of a method 1000 in accordance with one novelaspect. The steps 1001-1017 of method 1000 are steps in the exampledescribed above.

FIG. 23 is a diagram of ME island 40 and MU island (TransactionalMemory) 42, 52. In FIG. 23, an arrow labeled with a number in a circlecorresponds to the step in of FIG. 22 that is labeled with the samecircled number.

FIG. 24 is a simplified logic flowchart that illustrates functionspipeline 89 can perform. Steps 2001-2004 correspond to steps 1008-1010of the flowchart of FIG. 22. In the example described above inconnection with FIG. 14, the scenario involved the hash key not beingfound and as a result the missing hash key was added to the hash bucketlocation. These operations are shown in FIG. 24 in blocks 2005-2007. Ifthe hash key is not found, and there are no vacant hash bucket locationswithin the hash bucket location, then (step 2008) the results packetsent to the microengine indicates that the hash key was not found andthat the hash key was not added to the hash bucket. In other scenarios,the hash key is found in the hash table. This corresponds to match founddecision diamond 2005 being true and processor flow proceeding to block2009. When the hash key is found in the hash table, there are twopossibilities: the hash bucket location is locked or the hash bucketlocation is unlocked. The situation of the hash bucket location beinglocked corresponds to decision diamond 2010 being true and process flowproceeding to block 2011. The lock field in the results packet is setand the results packet is sent (step 2014) to the initiating microengineto inform the initiating microengine that the associated data structureis locked by another microengine. The situation of the hash bucketlocation being unlocked corresponds to locked decision diamond 2010being false and process flow proceeding to block 2012. The lock field inthe results packet is cleared to “0” indicating to the initiatingmicroengine that the associated data structure is not locked. Theupdated hash bucket is written into the hash table (step 2013), and theresults packet is sent to the initiating microengine (step 2014)indicating to the initiating microengine that the hash key was found andthat the associated data structure is not locked by another microengine.

FIG. 25 (Prior Art) is a diagram of a prior art transactional memory3000 in a network processor integrated circuit 3001 sold by NetronomeSystems, Inc., 5201 Great America Parkway, Santa Clara, Calif., 95054.The integrated circuit 3001 is part of a network device that that is onlocal area network with multiple users. Multiple tables 3002-3005 werestored in memory 3006 of a Dcache 3007. A microengine 3008 receivedethernet packets from the local area network. Each received ethernetpacket was received onto the network device and in turn onto theintegrated circuit 3001 via a physical port and a virtual port. Table3002 includes a packet count and byte count row for each physical port.Table 3003 includes a packet count and byte count row for virtual port.The packet may have been received from one of the users on the network.Table 3004 includes a packet count and byte count row for each suchuser. A received packet may also be associated with an applicationprogram executing on the user terminal. Table 3005 includes a packetcount and byte count row for each such application program. In oneexample, the application program may be a web browser such as internetexplorer.

In one operation, a packet is received onto the integrated circuit 3001.The packet count and byte count values maintained in the tables3002-3005 in memory 3006 are updated. A microengine that receives theincoming ethernet packet updates the counts in the tables 3002-3005 byissuing read and write commands to bulk engine 3010 across CPP bus 3009and data bus interface 3011. The bulk engine 3010 actually handles theread and writes from memory 3006. Typically for each incoming packetthere were sixteen bulk read and write commands performed: two to updatethe packet count for physical port, two to update the byte count forphysical port, two to update the packet count for virtual port, two toupdate the byte count for virtual port, two to update the packet countfor user ID, two to update the byte count for user ID, two to update thepacket count for application type, and two to update the byte count forapplication type. Each update operation involved reading a count valuefrom memory 3006, adding a number to that count, and then writing theupdated count value back into memory 3006 to the same memory location.In the case of a packet count, the packet count is incremented by one.In the case of a byte count, the number of bytes of the incomingethernet packet is added to the prior byte count.

FIG. 26 is a diagram of MU island (“Transactional Memory”) 42, 52showing the stats hardware engine 73 in further detail. Like the atomichardware engine 71 described above, the stats hardware engine 73 istightly coupled to memory 90 within Dcache (“memory unit”) 76. Theatomic hardware engine 71 interfaces to Dcache 76 using certain inputand output FIFOs, whereas the stats hardware engine 73 interfaces toDcache 76 using certain other input and output FIFOs. Like the atomichardware engine 71 described above, the stats hardware engine 73includes a state machine array 3012, a pipeline 3013, a state machineselector 3014, an arbiter 3015, a translator 3016, and a register pool3017. The state machines SM#1 to SM#N share use of the pipeline. In theexample shown in FIG. 26 all state machines SM#1 to SM#N share thesingle pipeline 3012. In another example, state machines SM#1 to SM#Nshare multiple pipelines. Any one of the state machines can execute anAdd and Update command (AU Command) to update eight count values. Foreach count value, the state machine and pipeline 3013 operate togetherto cause a count value to be read from memory 90, to cause a value to beadded to the count value thereby generating an updated count value, andto cause the updated count value to be written back into the memorylocation in memory 90. The memory controller 3018 actually performs thememory reads and writes at the direction of the pipeline 3013. The MUisland (“transactional memory”) 42, 52 does not include any processorthat fetches instructions from a memory, decodes the instructions, andexecutes the instructions. In one example, microengine 160 receives anethernet packet. The ethernet packet has an associated physical port,virtual port, user ID and application type. The packet is a number ofbytes in length. Microengine 160 may receive multiple such ethernetpackets so that a packet number value greater than one is to be added tothe packet counts stored in memory 90, or microengine 160 may elect toperform the updating of the count values in memory 90 for just oneethernet packet. Regardless of the packet number value and the bytenumber value to be added to the count values in memory 90, themicroengine 160 issues one Add and Update command (“AU Command”) 3019across the CPP command mesh of CPP bus 159. The AU command 3019 is ofthe format shown in FIG. 4. The AU command does not include anyaddresses of memory locations within the Dcache 76. The ACTION fieldindicates that the command is an AU command. The DATA_REF field gives apull-id identifier for the AU command. The AU command 3019 includes thepacket number value and the byte number value. A starting address valueand a number of addresses to follow value is also included in the AUcommand. The starting address value points to a memory location withinmicroengine 160. The number of addresses to follow value indicates howmany addresses sequentially stored in the microengine memory (startingat the starting address value) are to be pulled onto the transactionalmemory 42, 52. The state machine selector 3014 monitors the statusindicator of each state machine, and routes the AU command to an idlestate machine.

FIG. 27 is a state diagram for a state machine of the stats hardwareengine 73. The state machine transitions from the idle state 3020 to thepull state 3021 when an AU command sent by microengine 160 is receivedby the stats machine. The state machine causes a pull-id bus transactionto be sent back to the microengine 160 via data bus interface 75 and CPPbus 159. The format of the pull-id bus transaction is shown in FIG. 5.The DATA_REF field contains the pull-id identifier that the microengine160 provided in the original AU command. The TARGET_REF field containsan identifier supplied by the state machine target. This target_ref isusable by the target to identify later received data payloads with thepull-id. The starting address value and number of addresses to followvalue are also included in the pull-id bus transaction. The pull-id bustransaction is received by microengine 160 across the pull-id mesh. Fromthe DATA_REF field of the pull-id bus transaction, the microengine 160determines that the pull-id is associated with the original AU commandand that the microengine 160 should return to the target a set ofaddresses. The addresses identify memory locations in memory 90 wherethe count values to be updated are stored. Microengine 160 thereforeresponds by sending one or more data bus transactions across the data0or data1 mesh to register pool 3017. Register pool 3017 includes acontroller and a plurality of registers. In one example, each registerof the register pool is associated with an individual state machine ofthe state machine array 3012. The format of the data bus transactions isset forth in FIG. 6. The microengine 160 includes the TARGET_REFidentifier from the pull-id so that the receiving state machine canassociate the incoming data bus transactions with the pull-id. There maybe one or more such data bus transactions. The LAST bit of a data bustransaction indicates whether there are more data bus transactions tofollow, or whether the data bus transaction is the last data bustransaction for the pull-id. The DATA fields of these data bustransactions include the addresses where the count values are stored.

Once all the pull data has been received and is stored in theappropriate register in register pool 3017, then the state machineoperation transitions from PULL state 3021 to OUTPUT state 3022. Thestate machine outputs an operation instruction 3023 to arbiter 3015.Once the output operation is complete, state machine operationtransitions from OUTPUT state 3022 to IDLE state 3020. The arbiter 3015arbitrates information flow to translator 3016. Translator 3016 receivesthe operation instruction 3023 and from the operation instructionoutputs OP CODES 3024, PACKET # VALUE 3025, and BYTE # VALUE 3026. ThePACKET # VALUE 3025 and the BYTE # VALUE 3026 are the numbers to beadded to the count values stored in memory 90 once the count values havebeen read out of memory 90.

The request stage of the pipeline supplies the state machine number tothe register pool. The register pool uses the state machine number toreturn to the pipeline the first address 3031 stored in the registerpool for that state machine number. The request stage uses this addressto issue a read request to memory controller 3018 via FIFOs 3027-3030and crossbar switches 95 and 96. The memory controller 3018 handlesreading the first pair of count values 3032 from the memory locationindicated by the first address 3031 pulled out of the register pool. Theread stage of the pipeline receives the first pair of count values 3032.In the present example, the first pair of count values 3032 is a packetcount and byte count read from physical port table 3033. In the exampleof FIG. 26 each row of the physical port tables 3033 is a memorylocation that stores two values, a packet count value and a byte countvalue. In other examples, the memory location may store other valuessuch as number of users per server or connections per user. An ALU inthe adder stage adds the PACKET # VALUE 3025 and BYTE # VALUE to thefirst pair of count values 3032, thereby generating an updated pair ofcount values 3037. The write stage of the pipeline causes the updatedpair of count values 3037 to be written back into the memory location inphysical port table 3033. The pipeline causes the update to be performedby issuing a write request to memory controller 3018. This completes theupdating of one pair of count values. There are, however, four updatesto be performed (updating the pair of count values for the physicalport, virtual port, user id, and application type). In the next clockcycle after the request stage received the first address 3031 from theregister pool, the request stage receives the next address from theregister pool, and in the next clock cycle the request stage receivesthe next address, and so forth. During a given clock cycle, each stageof the pipeline is processing an update to a different pair of countvalues. Packet count values can be either incremented by one or can beincreased by a number greater than one depending on the PACKET # VALUE3025 received in the AU command from the microengine 160. Byte countvalues are increased by the BYTE # VALUE 3026 received in the AU commandfrom the microengine 160. There is only one AU command issued across thecommand mesh of the CPP data bus 159 despite the fact that eight countupdates are performed.

In addition to executing the Add and Update command, the stats hardwareengine 73 can also execute a stats “Read and Clear” (RC) command. Thestats read and clear command is similar to the stats AU commanddescribed above in that one command is sent across the command mesh ofthe CPP bus but multiple memory operations result. Rather than writingback a count value into each memory location, the stats read and clearcommand results in writing a zero value into each indicated memorylocation. The write stage returns STATS DATA 3038 that is sent via databus interface 75 and CPP data bus 159 to the microengine 160. The STATSDATA 3038 is the set of count values for all the memory locations thatwere cleared. In one embodiment the clear function is performed by theadder stage. In another embodiment, the clear function is performed by aseparate stage within the pipeline.

FIG. 28 is a flowchart 4000 illustrating the operation of stats engine73. A set of first values are stored (Step 4001) into correspondingmemory locations in the memory unit. An Add and Update command (AUcommand) is received onto the hardware engine (Step 4002). In responseto receiving the AU command, each memory location is read from memory(step 4003). A same second value is then added to each of the firstvalues (Step 4004) thereby generating a corresponding set of updatedfirst values. The set of updated first values are written into thecorresponding memory locations (Step 4005).

In one example, the pipeline within the stats engine is the onlycircuitry that can read or write to the memory locations in memory 90.In another example, the pipeline within the stats engine is the onlycircuitry that does read or write to the memory locations. In eitherexample, the memory locations in memory 90 shown in FIG. 26 do notrequire a locking mechanism because the single pipeline is the onlycircuitry that will read data from or write data to the memory locationsduring operation.

Op codes 3024 is supplied to each ALU in each state of the pipeline. Opcodes 3024 includes one operation code (op code) for each stage of thepipeline. Each operation code includes a plurality of bits. Theparticular combination of these bits indicate one of several differentoperation commands. The operation performed in each stage of thepipeline can be varied by changing the op code assigned to a givenpipeline stage. For example, the operation of the third stage of thepipeline 3013 can be changed from adding values to subtracting values bychanging the operation code assigned to the third stage of the pipeline.This allows flexible programming of each stage of the stats engine 73.

FIGS. 29-38 set forth a recursive lookup operation involving a hardwaretrie structure 5000 that has no sequential logic elements. In the method5001 of FIG. 29, a router 5014 receives an IP packet 5015 (step 5002) onan input port of the router. The input port is one of many virtual portsof a physical input port 5016. Router 5014 includes a plurality of linecards 5017-5019 and a management card 5020 that fit into a attach to abackplane 5021. The line cards are identical. Line card 5017 includesoptics transceivers 5022 and 5023, PHYs 5024 and 5025, an instance ofthe Island-Based Network Flow Processor (IB-NFP) integrated circuit 1 ofFIG. 1, configuration PROM 8, and DRAM integrated circuits 2-7. The IPpacket 5015 is communicated through optical fiber 5026, through opticstransceiver 5022, through PHY 5024, and to IB-NFP 1. The IB-NFP 1 inthis router looks at the IP destination address of the packet andidentifies one of several output ports to which the IP packet is to berouted. The IB-NFP then forwards the IP packet so that the IP packetwill be output from the router via the determined output port. In theillustrated example, the output port may be one of many virtual outputports of physical output port 5027, or may be one of the many virtualoutput ports of physical output port 5028, or may be one of the manyvirtual output ports of physical output port 5029.

FIG. 31 is a diagram that illustrates a second step (step 5003) in whicha processor 160 of ME island 40 of the IB-NFP 1 sends a lookup command5030 across the CPP data bus 159 to the transactional memory in the MUisland 42, 52. Lookup engine 74 is one of several hardware engines ofthe MU island as indicated earlier in this patent document. The lookupengine 74 is illustrated in more detail here and illustrations of theother lookup engines are omitted. Lookup command 5030 includes addressinformation that indicates where a 3×128-bit block 5031 of data isstored in memory 90 of the Dcache memory unit 76. The lookup command5030 is received (step 5004) from the CPP data bus 159 onto thetransactional memory via data bus interface 75. Lookup engine statemachine selector 5032 examines the status indicators of the statemachines SM#1-SM#N of state machine array 5033, and selects (step 5005)an idle state machine to process the incoming command.

FIG. 32 is a state diagram for a state machine of the lookup engine 74.Initially the state machine was in the idle state 5035. The statemachine selector 5032 passes the lookup command 5030 to the statemachine, thereby causing the selected state machine to transition tooperating in the pull state 5036. The selected state machine theninitiates a pull (step 5006) across the CPP data bus to receive an inputvalue (IV). For each IV value, there there is a final result valuestored. The overall function of the lookup operation is to receive oneof the IV values and to lookup and result its associated final resultvalue. In the present example, the IV value is the IP destinationaddress 5037 of IP packet 5015. The selected state machine interactswith the pull interface of data bus interface 75 to cause the pull tooccur.

In response, the IP destination address 5037 is received from the CPPbus 159 onto the transactional memory. The IP destination address 5034is then stored in an appropriate one of the registers in register pool5038. There is one register pool register associated with each statemachine. The IP address is received (step 5007) onto the transactionalmemory and is stored into the register associated with the state machinethat initiated the pull. As indicated by the state diagram of FIG. 32,completion of the pull causes the state machine to transition to theoutput state 5039. In the output state 5039, the state machine outputsan operation instruction 5040 (step 5008) to arbiter 5041. Arbiter 5041may receive several such operation instructions from multiple ones ofthe state machines. Arbiter 5041 arbitrates and only supplies one of theoperation instructions at a time to translator 5042. The translatortranslates the operation instruction 5041 into a set of op codes 5044,one for each stage of the pipeline 5043. In addition, the translator5042 outputs the memory address 5045 to the pipeline. Once the operationinstruction 5040 has been output from the state machine, the statemachine transitions to the wait for result state 5046.

The request stage 5047 of pipeline 5043 issues (step 5009) a readrequest to the memory unit 76 to read the 3×128-bit block 5031 of dataout of memory 90. The read request is pushed into input FIFO 5048. Theread request passes through input FIFO 5048, and IN cross-bar switch 95,and is handled by the memory controller of memory 90. This is the samememory controller that handles read requests received from otherhardware engines. The 3×128-bit block 5031 is read from memory 90, ispassed through OUT crossbar switch 96, the through output FIFO 5049, andinto the read stage 5050 of pipeline 5043.

The read stage 505 of the pipeline supplies the state machine number toregister pool 5038. In response, the IV (IP address 5037 in this case)is sent from the register pool back to the read stage 5050. At thispoint in the process, pipeline 5043 has received (step 5010) both the3×128-bit block of data and the IV (IP address in this case). Thesevalues are loaded into one long register R1 5051 of lookup stage 5052 ofthe pipeline.

FIG. 33 is a more detailed diagram of lookup stage 5052. Lookup stage5052 includes register R1 5051, a barrel shifter 5053, and ALU3 5054.ALU 3 includes a plurality of lookup hardware blocks 500 and 5055-5060,a decoder 5061, and an output multiplexing circuit 5062 interconnectedas shown. Register R2 5063 in FIG. 33 is the register R2 at the front ofthe result stage 5064 of the pipeline. The 32-bit result from one of thelookup hardware blocks is output as the 32-bit output of ALU3 5054.Which one of the results it is that is output by multiplexing circuit5062 is determined by OPCODE3 and TYPE.

FIG. 34 is a diagram of the 3×128-bit block 5031. The block includesthree 128-bit words. The first word WORD#1 includes an 8-bit type value,a 7-bit starting position value (SP), and seven 6-bit multi-bit nodecontrol values (NCVs) A-G. The second and third words WORD#2 and WORD#3include eight 32-bit multi-bit results values (RVs) R0-R7. Each RVincludes a final result bit (FRB). The memory 90 stores and outputs128-bit words, so the information to configure the hardware triestructure for a lookup is packed efficiently into a minimum number of128-bit words.

The type value, the NCVs and the RVs from the 3.×128-bit block 5031 areloaded into register R1 into the bit positions as indicated in FIG. 33.The outputs of the bits of register R1 are supplied in parallel to ALU3as illustrated in FIG. 33. In addition to the values from the 3×128-bitblock 5031 and the IV value 5037, the opcode OPCODE3 for the lookupstage 5052 is also stored in register R1. The lookup stage 5054 performsa three-level trie lookup operation in one pipeline clock cycle usingcombinatorial logic of the novel hardware trie structure 5000, therebyoutputting a 32-bit result value. In this specific example, the 32-bitresult value includes a 31-bit next hop output port identifier (step5011).

Rather than the first sixty-four bits of the 128-bit IP address valuebeing supplied directly to ALU3, the 128-bit IP address value may besupplied in shifted form. Barrel shifter 5053 shifts the 128-bit IPaddress 5037 by a number of bit positions. The number of bit positionsis indicated by the 7-bit starting portion value (SP). Due to the use ofbarrel shifter 5053, a 64-bit section of the IP address can be suppliedto ALU3 as the incoming IV value. The particular 64-bit section ispredetermined by the starting point value SP stored in the 3×128-bitblock. For simplicity of explanation here, the shifted IV value isreferred to below simply as the IV value, although it is understood thatthe IV value actually received by hardware trie structure 500 may be ashifted sixty-four bit section of the IV value 5037.

FIG. 35 is a more detailed diagram of barrel shifter 5053. Eachmultiplexing circuit represented by a multiplexer symbol in the diagraminvolves one hundred twenty-eight 2:1 multiplexers. Multiplexing circuit5065, for example, supplies either the incoming 128-bit IP address ontoits output leads in unshifted form if the select input signal SP[6] is adigital low, or the multiplexing circuit 5065 supplies the IP addressshifted sixty-four bits to the left. The leftmost sixty-four bits aretherefore not passed on to the next lower multiplexing circuit, and therightmost sixty-four bit positions of the 128-bit output value arefilled in with digital zero values. This first multiplexing circuit 5065shifts to the left by sixty-four bit positions if SP[6] is set, thesecond multiplexing circuit 5066 shifts to the left by thirty-two bitpositions if SP[5] is set, the third multiplexing circuit 5067 shifts tothe left by sixteen bit positions if SP[4] is set, and so forth.

FIG. 36 is a circuit diagram of hardware tri structure 5000 of ALU3 5054of FIG. 33. Hardware trie structure 5000 includes a plurality ofinternal node circuits 5068-5074 and a plurality of leaf node circuits5075-5082. Each internal node circuit receives and is configured by acorresponding one of the NCVs. The NCV is received onto select inputleads of a multiplexing circuit of the internal node circuit. Eachinternal node circuit also receives sixty-four bits of the 128-bit IVvalue as output by barrel shifter 5053. The 64-bit IV value is receivedonto the hardware trie structure 5000 via a set of input leads 5083 ofthe hardware trie structure. Each leaf node receives a corresponding oneof the RVs. A leaf node circuit, if it receives a digital high enablesignal from its corresponding upstream internal node circuit, suppliesits RV value onto the set of output leads 5084. Only one of the leafnode circuits is enabled at a time, so the leaf node circuits togetherperform a multiplexing function in that one of the RV values is suppliedonto the set of output leads 5084, where which one of the RV values itis that is supplied onto the set of output leads is determined by theinternal node circuit portion of the trie structure. There is nosequential logic element in the circuitry of the hardware trie structure5000. The hardware trie structure is set up by supplying the NCVs A-G tothe internal node circuits of the trie structure, and by supplying theRV values R0-R7 to the leaf node circuits of the trie structure.Supplying an IV value onto the set of input leads 5083 causes signals topropagate through the hardware trie structure 5000 such that a selectedone of the RV values is output onto the output leads 5084.

FIG. 37 is a diagram that illustrates operation of the hardware triestructure 5000. The 64-bit value IV is supplied to the root internalnode circuit 5068. One of the bits of the 64-bit value IV is selectedand is output. Which one of the bits it is that is output is determinedby the value A. If the selected bit has a value of a digital high thendecision flow proceeds downward in the tree to internal node circuit5070, whereas if the selected bit has a value of a digital low thendecision flow proceeds upward in the tree to internal node circuit 5069.

Consider the situation in which the selected bit was a digital high.Once a branch is not taken, all sub-branches to the right carryunasserted signals. Accordingly, in the example of FIG. 37, none ofR0-R3 can be selected as the output result value of the trie. Internalnode circuit 5070 selects another bit of the 64-bit value IV asdetermined by the value C. If this second selected bit has a value of adigital high then decision flow proceeds downward in the tree tointernal node circuit 5074, whereas if the second selected bit has avalue of a digital low then decision flow proceeds upward in the tree tointernal node circuit 5073. In this way, decision flow passes throughthe trie structure such that only one asserted signal is output to oneoutput of one of the internal node circuits. For example, if the bitindicated by A is a digital high, and if the bit indicated by C is adigital low, and if the bit indicated by F is a digital high, thendecision flow terminates at the R5 next hop output port identifier. Onlythis R5 value is selected. Likewise, in the specific circuit of FIG. 36,if the bit of IV indicated by A is a digital high, and if the bit of IVindicated by C is a digital low, and if the bit of IV indicated by F isa digital high, then the enable signal supplied to leaf node circuit5080 is asserted. The enable signals to all other leaf node circuits arenot asserted. Leaf node circuit 5080 therefore outputs the RV value R5onto the set of output leads 5084. Each RV value is output when threeidentified bits of the IV value have three particular digital values. Inthe example being described here, the IV value is supplied to thehardware trie structure, along with the configuring NCVs and RVs, sothat the hardware trie structure outputs (step 5011) one RV value ontooutput leads 5084.

FIG. 38 is a diagram that shows the various bits of a result value asoutput by the hardware trie structure 5000. If the final result bit(FRB) is a digital logic low, then the remaining thirty-one bits of theRV contain the algorithmic lookup result. In the example of the routerbeing described here, a final lookup result value is a next hop outputport identifier. The result stage of the pipeline interacts with thedata bus interface 75 to cause the result value to be sent to processor160 in the ME that initiated the original lookup command 5030. Asillustrated in FIG. 32, state machine operation transitions from thewait for result state 5046 to the idle state 5035.

In the specific example of the method of FIG. 29, the FRB bit of theresult value is clear indicating a final result value. The result stage5064 of the pipeline therefore initiates a CPP bus push of the finalresult value 5085 (including the 31-bit algorithmic lookup result valueoutput by the hardware trie structure) back to processor 160, so thatthe next hop value is returned (step 5012) to the processor 160 thatissued the original lookup command. As a result, router 5014 outputs(step 5013) the IP packet 5015 onto the output port of the routeridentified by the final result 5085 (a next hop output port identifier).

As indicated in FIG. 38, the FRB bit of the result value output by thehardware trie structure 5000 need not be a digital logic low. If the FRBis a digital logic high, then the 31-bit remainder of the RV value issupplied back to the state machine of the lookup engine. The statemachine transitions from the wait for result state 5046 to the outputstate 5039. The state machine receives this 31-bit value as a form of aninstruction to perform another lookup operation. Rather than the addressinformation on where to read a block from memory 90 coming from anoriginal lookup command, the address information is supplied as part ofthe 31-bit result value. For example, if bit 30 is a digital logic lowand if bit 29 is also a digital logic low, then the next lookup will bean algorithmic lookup. There are several types of algorithmic lookups,one of which is the trie lookup described above. What type ofalgorithmic lookup it is that is to be performed in the next lookup isnot indicated in the result value supplied to the state machine, butrather is indicated by the type value of the next 3×128-bit block to beread from memory 90. Bits 23: 0 are a 24-bit starting address in memory90 where the beginning of the next 3×128-bit block to be read is stored.Bits 28:27 indicate how many 128-bit words to read starting at thataddress. These values are used to read an indicated second number of128-bit words from memory 90. If the type value indicates the nextlookup is another trie lookup, then the process repeats as describedabove with the values of the 3×128-bit block being used to configure thehardware trie hardware for the second lookup. If the type valueindicates another type of lookup, then the contents of the 128-bit wordsare used in other ways by another selected one of the lookup hardwareblocks 5055-5060. In this way, successive lookup operations can beperformed by the lookup engine on different parts of the IP addressuntil a final result is obtained. In the case of the next lookup being adirect lookup, then the type of direct lookup is determined byinformation in the non-final result value of the prior lookup. In thecase of the next lookup being an algorithmic lookup, then the type ofalgorithmic lookup is determined the type value in the 3×128-bit blockread from memory 90 at the beginning of the next lookup. When a lookupresults in a final result being obtained, then the result stage 5064initiates a CPP bus push operation to return the 31-bit final result(next hop output port indicator) back to the requesting processor viadata bus interface 75 and CPP data bus 159.

The novel hardware trie structure, the transactional memory thatcontains it, and the related methods described above are of generalutility in looking up different types of information and are not limitedto looking up next hop output port information from incoming IPaddresses. Although the IV is pulled across the bus in a second bustransaction after the initial lookup command passes across the bus in afirst bus transaction in the example described above, the IV in otherexamples can be a part of the original lookup command.

FIG. 33 shows the various hardware lookup blocks within lookup engine74. Only one output of the various hardware lookup blocks is utilizedduring a specific clock cycle. The contents stored in register R1 5051varies depending on which hardware lookup block is being utilized in thegiven clock cycle. Register R1 5051 is coupled to each hardware lookupblock. In one example, to reduce power consumption OP CODE is alsosupplied to each hardware lookup block and causes only one of thehardware lookup blocks to be turned on during a given clock cycle. Inanother example, OP CODE is only supplied to multiplexer 5062 and causesa single hardware lookup block output to be coupled the results stage.In one example, multiplexer circuit 5062 may be implemented utilizing aplurality of multiplexers. Three of the hardware lookup blocks(5055-50557) shown in FIG. 33 are direct lookup blocks. One of the threehardware lookup blocks (5055-5057) shown in FIG. 33 is a direct 32-bitlookup hardware lookup block 5055.

FIG. 39 illustrates the values communicated in the lookup engine 74during a direct 32-bit lookup. In one example, upon receiving anethernet packet microengine 160 sends a lookup command 6000 totransactional memory 42, 52 via a CPP bus 159. In this example, thepurpose of the lookup command 6000 is to determine what physical portand virtual port the ethernet packet is to be routed to. The lookupcommand 6000 includes a base address value, a starting bit positionvalue, and a mask size value. The combination of the base address value,starting bit position value, and mask size value is referred to asaddress information 6003. In another example, the mask size value ispredetermined and not included in the address information 6003. Thelookup command 6000 is communicated through the data bus interface 75 tostate machine selector 5032. State machine selector 5032 monitors thestatus indicator in each state machine within state machine array 5033and routes lookup command 6000 to idle state machine SM#1. In responseto receiving lookup command 6000, the selected state machine SM#1 issuesa pull-id command to the initiating microengine 160.

FIG. 32 is a state machine state diagram. The state machine transitionsfrom the idle state 5035 to the pull state 5036 when a lookup command6000 sent by microengine 160 is received by the state machine. The statemachine causes a pull-id bus transaction to be sent back to themicroengine 160 via data bus interface 75 and CPP bus 159. The format ofthe pull-id bus transaction is shown in FIG. 5. The DATA_REF fieldcontains the pull-id identifier that the microengine 160 provided in theoriginal lookup command 6000. The TARGET_REF field contains anidentifier supplied by the state machine target. This target_ref isusable by the target to identify later received data payloads with thepull-id. The starting address value and number of addresses to followvalue are also included in the pull-id bus transaction. The pull-id bustransaction is received by microengine 160 across the pull-id mesh. Fromthe DATA_REF field of the pull-id bus transaction, the microengine 160determines that the pull-id is associated with the original lookupcommand 6000 and that the microengine 160 should return to the target aninput value 6005. In one example, the input value 6005 is a destinationInternet Protocol (IP) address. The IP address 6005 is used by thelookup engine 74 to determine the destination (physical port and virtualport) to which the ethernet packet should be sent. Microengine 160therefore responds by sending one or more data bus transactions acrossthe data0 or data1 mesh to register pool 5038. Register pool 5038includes a controller and a plurality of registers. In one example, eachregister of the register pool 5038 is associated with an individualstate machine of the state machine array 5033. The format of the databus transactions is set forth in FIG. 6. The microengine 160 includesthe TARGET_REF identifier from the pull-id so that the receiving statemachine can associate the incoming data bus transactions with thepull-id. There may be one or more such data bus transactions. The LASTbit of a data bus transaction indicates whether there are more data bustransactions to follow, or whether the data bus transaction is the lastdata bus transaction for the pull-id. The DATA fields of these data bustransactions include the addresses where the count values are stored.

Once all the pull data has been received and is stored in theappropriate register in register pool 5038, then the state machineoperation transitions from PULL state 5036 to OUTPUT state 5039. Thestate machine outputs an operation instruction 6001 to arbiter 5041.Once the output operation is complete, state machine operationtransitions from OUTPUT state 5039 to WAIT FOR RESULT state 5046. Duringthe WAIT FOR RESULT state 5046, the pipeline requests and reads a128-bit word 6007 from memory 90, selects one of four 32-bit resultvalues included in the received 128-bit word 6007, and returns theselected result value 6008 to the state machine (SM#1).

FIG. 43 illustrates an example of the different fields included inresult value 6008. The result value 6008 includes a final result field.In one example, the final result field is 1-bit wide. The result value6008 has a first set of fields when the result value 6008 is a finalresult value. The result value 6008 has a second set of fields when theresult value 6008 is not a final result value. When the result value6008 is a final result value, 31 bits of the 32-bit result value is thedesired lookup result field. When the result value 6008 is not a finalresult, the result value includes a type of lookup field, a base addressfield, a start bit position field, and a mask size field. If the finalresult field is set, a final result value has been found and the statemachine operation transitions from WAIT FOR RESULT state 5046 to IDLEstate 5035 and the result value 6008 is sent the ME. In one example, theresult value 6008 is a next hop output port identifier. If the finalresult field is not set, the final result value has not been found andthe state machine operation transitions from WAIT FOR RESULT state 5046to OUTPUT state 5039 and a subsequent lookup operation is performedbased upon the contents of the selected result value 6008. The arbiter5041 arbitrates information flow to translator 5042. Translator 5042receives the operation instruction and from the operation instructionoutputs new OP CODES and new address information. Address informationincludes a base address, starting bit position, and mask size that areused in the pipeline to retrieve another result value.

As shown in FIG. 39, pipeline 5043 includes request stage 5047. Requeststage 5047 of the pipeline 5043 is shown in greater detail in FIG. 41.Request stage 5047 includes FIFO F1 6013 and ALU 1 6014. ALU 1 6014includes selecting circuit 6020 and adding circuit 6012. Selectingcircuit 6020 includes barrel shifter 6009 and mask circuit 6010. Therequest stage of the pipeline supplies the state machine number to theregister pool 5038. The register pool 5038 uses the state machine numberto return to the pipeline the input value (IP address) 6005 stored inthe register pool 5038 for that state machine number. The request stageuses the starting bit position and mask size to select a portion 6015 ofthe input value (IP address) 6005. In one example, the portion 6015 isan eight bit portion of the input value (IP address) 6005. The portion6015 is selected by performing a barrel shift operation followed by amasking operation. The barrel shift operation is performed by barrelshifter 6009. Barrel shifter 6009 receives the input value (IP address)6005 and starting bit position 6016 and generates a shifted version ofinput value (IP address) 6005. A detailed circuit diagram of the barrelshifter 6009 is provided in FIG. 35. Description of the barrel shifteroperation is provided in the description of FIG. 35 above. Mask circuit6010 receives the shifted version of the input value (IP address) 6005from barrel shifter 6009 and the mask size 6017 and performs a maskingoperation whereby all bits received from the barrel shifter are maskedout with exception to the desired portion bits 6015. In one example,masking circuit 6010 is an array of AND gates where all undesired bitsare anded with “0” and desired bits are anded with “1”. The portion bits6015 are then separated into two different bit groupings. In oneexample, the portion 6015 is an eight bit value that is separated into afirst two bit group PORTION [0:1] and a second six bit group PORTION[2:7]. Adding circuit 6012 receives PORTION [2:7] and base address 6018and generates memory address 6019. Memory address 6019 is included inread request 6006 (shown in FIG. 39). PORTION [0:1] is communicated tothe following stages of the pipeline and is utilized within the lookupstage 5052. Request stage 5047 then issues a read request to memorycontroller 97 via FIFO 5048 and crossbar switch 95. The memorycontroller 97 handles reading a single 128-bit word 6007 from the memorylocation indicated by the read request 6006. FIG. 40 illustrates how thedirect 32-bit result values are packed in memory 90.

As shown in FIG. 39, read stage 5050 of pipeline 5043 includes FIFO F2and ALU 2. In response to the read request 6006 send by request stage5047, read stage 5050 of the pipeline 5043 receives 128-bit word 6007from memory 90 via crossbar switch 96 and FIFO 5049. In one example, the128-bit word 6007 includes four 32-bit result values (as shown in FIG.40). Read stage 5050 also receives PORTION[0:1] from the read stage5050. Read stage 5050 then writes both the 128-bit word 6007 and PORTION[0:1] to register R1 5051 within lookup stage 5052.

As shown in FIG. 39, pipeline 5043 includes register lookup stage 5052.Lookup stage 5052 of the pipeline is shown in greater detail in FIG. 42.Lookup stage 5052 includes register R1 5051 and ALU 3 5054. ALU 3 5054includes a multiplexing circuit 6011. In one example, multiplexingcircuit 6011 includes thirty-two one by four multiplexers. multiplexingcircuit 6011 receives PORTION [0:1] and the four 32-bit result valuesfrom the 128-bit word 6007 received in read stage 5050. The multiplexingcircuit 6011 selects one of the four 32-bit result values based upon thevalue of PORTION [0:1]. The selected 32-bit result value is then writtento register R2 5063 of result stage 5064. Result stage 5064 causes theselected result value to be communicated to the initiating statemachine.

FIG. 43 is a flowchart 6100 illustrating the direct 32 bit lookupoperation of lookup engine 74. Router receives an ethernet packet on aninput port (Step 6101). The ethernet packet includes a destination IPaddress. The ethernet packet is communicated to a microengine within therouter. The microengine sends a lookup command to the transactionalmemory (Step 6102). The lookup command includes a base address value, astarting bit position value, and a mask size value. The base addressvalue, starting bit position value, and mask size value are referred toas address information. The lookup command is received onto thetransactional memory via the CPP bus (Step 6103). In response toreceiving the lookup command, an idle state machine is selected toreceive the command by a state machine selector (Step 6104). In responseto receiving the lookup command, the selected state machine initiates apull across the CPP bus to read the input value (destination IP address)of the ethernet packet from the microengine (Step 6105). The input value(destination IP address) is then received onto the transactional memoryand stored in a register pool (Step 6106). The state machine then sendsan operation instruction to a translator that causes the translator tosend OP-CODES and address information to the pipeline (Step 6107). Therequest stage 5047 uses the input value (destination IP address) and theaddress information to determine a memory address. The request stage5047 of the pipeline then issues a read request (including the memoryaddress) to the memory unit to read a single 128-bit word (Step 6108).The pipeline then receives the 128-bit word from the memory unit (Step6109). The lookup stage of the pipeline then selects one of four 32-bitresult values from 128-bit word in one clock cycle using combinationallogic (Step 6110). The result of the direct 32-bit lookup is a single32-bit result value. The 32-bit result value is communicated back to theinitiating state machine (Step 6111). The 32-bit result value is pushedback from the state machine to the microengine via the data businterface of the transactional memory and the CPP data bus (Step 6112).The router then outputs the ethernet packet onto an output portindicated by the 32-bit result value (Step 6113).

Op codes 6002 is supplied to each ALU in each state of the pipeline. Opcodes 6002 includes one operation code (op code) for each stage of thepipeline. Each operation code includes a plurality of bits. Theparticular combination of these bits indicates one of several differentoperation commands. The operation performed in each stage of thepipeline can be varied by changing the op code assigned to a givenpipeline stage. For example, the operation of the lookup stage of thepipeline 5043 can be changed from performing a direct 32-bit lookup to adirect 24-bit lookup. This allows flexible programming of each stage ofthe lookup engine 74 so that various lookup operations can be performedby the single lookup engine.

FIG. 45 is a flowchart of a method 7000 in accordance with another novelaspect. The lookup engine of the transactional memory has multiplehardware lookup structures. The lookup engine is configurable in a firstconfiguration such that a first hardware lookup structure of the lookupengine is usable to perform a first lookup operation. The lookup engineis also configurable in a second configuration such that a secondhardware lookup structure of the lookup engine is usable to perform asecond lookup operation. The first lookup operation may, for example, bea first type of lookup such as a direct lookup operation, and the secondlookup operation may be a second type of lookup such as an algorithmiclookup operation. The first lookup operation may be the direct 32 lookupoperation described above and the second lookup operation may be thehardware trie lookup operation described above.

Initially, a lookup command and an input value (IV) are received (step7001) onto the transactional memory 42, 53. In some examples, the IV isnot a part of the lookup command but rather is received onto thetransactional memory in a second bus transaction. In other examples, theIV is a part of the lookup command. The bus across which the lookupcommand is received onto the transactional memory is CPP data bus 159. Afirst block of first information is read (step 7002) from memory unit 76of the transactional memory by lookup engine 74. In one example, thelookup command includes address information that the lookup engine usesto read the first block of first information from the memory unit.

The lookup engine then uses the first information to configure (step7003) the lookup engine in the first configuration. The lookup engine soconfigured is used to perform a first lookup operation (step 7004) on apart of the input value. The part of the input value may be determinedby a starting point value (SP) of the first information. A barrelshifter within the lookup engine may receive the starting point value sothat the barrel shifter outputs the part of the input value that is usedas an input value for the lookup operation. As a result of the firstlookup operation, the lookup engine obtains a first result value (step7005). Based on the first result value, the lookup engine determines(step 7006) to do one of the following: 1) perform a second lookupoperation, 2) output the first result value from the transactionalmemory as the final result of the lookup command.

In one example, the first result value has a Final Result Bit (FRB). Thevalue of the FRB indicates whether the first result value is a finalresult value. If the first result value is a final result value, thenthe first result value is output from the transactional memory as thefinal result of the lookup command. If, on the other hand, the FRBindicates that the first result value is not a final result value, thenaddress information in the first result value is used by the lookupengine to read a second block of information from the memory unit.

In one specific example, the FRB of the first result value indicatesthat the first result value is not a final result value and that anotherlookup operation is to be performed. The lookup engine uses the secondinformation to configure (step 7008) the lookup engine in the secondconfiguration. The lookup engine so configured is used to perform asecond lookup operation (step 7009) on another part of the input value.As a result of the second lookup operation, the lookup engine obtains asecond result value (step 7010) and based on the second result value,the lookup engine determines (step 7011) to do one of the following: 1)perform a third lookup operation, 2) output the second result value fromthe transactional memory as a result of the lookup command. In this way,the lookup engine performs lookup operation after lookup operation in arecursive fashion until a final result value is obtained. In oneexample, the type of each successive lookup operation is determined atleast in part by a type value that is a part of the block of informationread from the memory unit at the beginning of the lookup operation.Address information in the result value of the previous lookup operationis used by the lookup engine to determine where to read the next blockof information from the memory unit. The address information alsoindicates how much information to read.

In one exemplary application, a first lookup operation is a directlookup type of lookup operation. If the first lookup operation does notresult in obtaining a final result value, then the result value of thefirst lookup operation is used to select either a direct lookup as thesecond lookup operation or an algorithmic lookup as the second lookupoperation. If the address space being considered in the second lookupoperation is densely packed with result values then the second lookupoperation is a direct lookup, whereas if the address space beingconsidered in the second lookup operation is sparsely populated withresult values then the second lookup operation is an algorithmic lookup.Each successive lookup operation looks at a different part of the inputvalue and may be a different type of lookup. The part of the input valuebeing considered in a lookup operation is determined by a barrel shiftercontrol value stored in the block of information for the lookupoperation. The type of the next lookup operation is determined by theresult value of the prior lookup and/or by type information of the blockof information read at the beginning of the next lookup operation. Ifthe address of the block in memory is dependent upon the key then thetype of lookup is encoded in the lookup command or lookup initiatingresult value, whereas if the address of the block in memory is notdependent upon the key then the type of lookup is set forth by the typefield in the block itself. The transactional memory that carries out thelookup command includes no processor that fetches instructions, decodesthe instructions, and executes the instructions. Method 7000 of FIG. 45is not limited to the particulars of the transactional memory 42, 52 ofthe specific example of IB-NFP 1, but rather is of general applicabilityand extends to other transactional memory and lookup enginearchitectures.

FIG. 33 shows the various hardware lookup blocks within lookup engine74. Only one output of the various hardware lookup blocks is utilizedduring a specific clock cycle. The contents stored in register R1 5051varies depending on which hardware lookup block is being utilized in thegiven clock cycle. Register R1 5051 is coupled to each hardware lookupblock. In one example, to reduce power consumption OP CODE is alsosupplied to each hardware lookup block and causes only one of thehardware lookup blocks to be turned on during a given clock cycle. Inanother example, OP CODE is only supplied to multiplexer 5062 and causesa single hardware lookup block output to be coupled the results stage.In one example, multiplexer circuit 5062 may be implemented utilizing aplurality of multiplexers. Three of the hardware lookup blocks(5055-50557) shown in FIG. 33 are direct lookup blocks. One of the threehardware lookup blocks (5055-5057) shown in FIG. 33 is a direct 24-bitlookup hardware lookup block 5056.

FIG. 46 illustrates the values communicated in the lookup engine 74during a direct 24-bit lookup. In one example, upon receiving anethernet packet microengine 160 sends a lookup command 8000 totransactional memory 42, 52 via a CPP bus 159. In this example, thepurpose of the lookup command 8000 is to determine what physical portand virtual port the ethernet packet is to be routed to. The lookupcommand 8000 includes a base address value, a starting bit positionvalue, and a mask size value. The combination of the base address value,starting bit position value, and mask size value is referred to asaddress information 8003. In another example, the mask size value ispredetermined and not included in the address information 8003. Thelookup command 8000 is communicated through the data bus interface 75 tostate machine selector 5032. State machine selector 5032 monitors thestatus indicator in each state machine within state machine array 5033and routes lookup command 8000 to idle state machine SM#1. In responseto receiving lookup command 8000, the selected state machine SM#1 issuesa pull-id command to the initiating microengine 160.

FIG. 32 is a state machine state diagram. The state machine transitionsfrom the idle state 5035 to the pull state 5036 when a lookup command8000 sent by microengine 160 is received by the state machine. The statemachine causes a pull-id bus transaction to be sent back to themicroengine 160 via data bus interface 75 and CPP bus 159. The format ofthe pull-id bus transaction is shown in FIG. 5. The DATA_REF fieldcontains the pull-id identifier that the microengine 160 provided in theoriginal lookup command 8000. The TARGET_REF field contains anidentifier supplied by the state machine target. This target_ref isusable by the target to identify later received data payloads with thepull-id. The starting address value and number of addresses to followvalue are also included in the pull-id bus transaction. The pull-id bustransaction is received by microengine 160 across the pull-id mesh. Fromthe DATA_REF field of the pull-id bus transaction, the microengine 160determines that the pull-id is associated with the original lookupcommand 8000 and that the microengine 160 should return to the target aninput value 8005. In one example, the input value 8005 is a destinationInternet Protocol (IP) address. The IP address 8005 is used by thelookup engine 74 to determine the destination (physical port and virtualport) to which the ethernet packet should be sent. Microengine 160therefore responds by sending one or more data bus transactions acrossthe data0 or data1 mesh to register pool 5038. Register pool 5038includes a controller and a plurality of registers. In one example, eachregister of the register pool 5038 is associated with an individualstate machine of the state machine array 5033. The format of the databus transactions is set forth in FIG. 6. The microengine 160 includesthe TARGET_REF identifier from the pull-id so that the receiving statemachine can associate the incoming data bus transactions with thepull-id. There may be one or more such data bus transactions. The LASTbit of a data bus transaction indicates whether there are more data bustransactions to follow, or whether the data bus transaction is the lastdata bus transaction for the pull-id. The DATA fields of these data bustransactions include the addresses where the count values are stored.

FIG. 47 illustrates how the direct 24-bit result values are packed inmemory 90. In one example, the direct 24-bit table 8014 only includesfinal result values. If all result values are final values each resultvalue may only require 24-bits of information compared to the 32-bitresult values of the direct 32-bit result values. This reduction inresult value size allows storage of thirty-two 24-bit result valueswithin seven 128-bit memory words (instead of the eight 128-bit memorywords required to store thirty-two 32-bit result values). The reductionin result value size results in a 12.5% improvement in memory densityover direct 32-bit memory packing. FIG. 47 illustrates four lookupblocks. Each lookup block includes seven 128-bit memory words. Each128-bit memory word includes one 8-bit field and five 24-bit fields.Five different result values are stored in the five 24-bit fields. Inone example, the 8-bit field is not used to store any information. Inanother example, five bits are used to select one of the 24-bit resultvalues in a lookup block thus limiting the addressable content of eachlookup block to thirty-two result values. In this example, the fiveselect bits of addressing within a lookup block results in only storingresult values in thirty-two of the thirty-five available 24-bit fieldswithin a lookup block. The locations of the three empty 24-bit fieldsare the same for every lookup block in a given embodiment. However, thelocations of the three empty 24-bit fields may vary in differentembodiments. The above example is only one exemplary embodiment of thepresent invention. In other embodiments the direct 24-bit table may alsoinclude non-final result values and the direct 24-bit table may storeresult values of various bit widths.

Once all the pull data has been received and is stored in theappropriate register in register pool 5038, then the state machineoperation transitions from PULL state 5036 to OUTPUT state 5039. Thestate machine outputs an operation instruction 8001 to arbiter 5041.Once the output operation is complete, state machine operationtransitions from OUTPUT state 5039 to WAIT FOR RESULT state 5046. Duringthe WAIT FOR RESULT state 5046, the pipeline requests and reads a128-bit word 8007 from memory 90, selects one of five 24-bit resultvalues included in the received 128-bit word 8007, and returns theselected result value 8008 to the state machine (SM#1).

FIG. 43 illustrates an example of the different fields included inresult value 8008. The result value 8008 does not include a final resultfield. In the present embodiment, all result values stored within the24-bit result table in memory 90 are final result values, therefore each24-bit lookup command results in a single memory read from memory. Theresult value is then communicated to the initiating state machine. Thestate machine operation transitions from WAIT FOR RESULT state 5046 toIDLE state 5035 and the result value 6008 is sent the ME. In oneexample, the result value 6008 is a next hop output port identifier. Inanother embodiment, the result values stored within the 24-bit resulttable are both non-final result values and final result values. If thefinal result field is not set, the final result value has not been foundand the state machine operation transitions from WAIT FOR RESULT state5046 to OUTPUT state 5039 and a subsequent lookup operation is performedbased upon the contents of the selected result value. The arbiter 5041arbitrates information flow to translator 5042. Translator 5042 receivesthe operation instruction and from the operation instruction outputs newOP CODES and new address information. Address information includes abase address, starting bit position, and mask size that are used in thepipeline to retrieve another result value.

As shown in FIG. 46, pipeline 5043 includes request stage 5047. Requeststage 5047 of the pipeline 5043 is shown in greater detail in FIG. 48.Request stage 5047 includes FIFO F1 6013 and ALU 1 6014. ALU 1 6014includes selecting circuit 8020, word selector circuit 8021, addingcircuit 8012, and multiplying circuit 8022. Selecting circuit 8020includes barrel shifter 8009 and mask circuit 8010. The request stage ofthe pipeline supplies the state machine number to the register pool5038. The register pool 5038 uses the state machine number to return tothe pipeline the input value (IP address) 8005 stored in the registerpool 5038 for that state machine number. The request stage uses thestarting bit position and mask size to select a PORTION 8015 of theinput value (IP address) 8005. In one example, the PORTION 8015 is aneight bit portion of the input value (IP address) 8005. The PORTION 8015is selected by performing a barrel shift operation followed by a maskingoperation. The barrel shift operation is performed by barrel shifter8009. Barrel shifter 8009 receives the input value (IP address) 8005 andstarting bit position 8016 and generates a shifted version of inputvalue (IP address) 8005. A detailed circuit diagram of the barrelshifter 8009 is provided in FIG. 35. Description of the barrel shifteroperation is provided in the description of FIG. 35 above. Mask circuit8010 receives the shifted version of the input value (IP address) 8005from barrel shifter 8009 and the mask size 8017 and performs a maskingoperation whereby all bits received from the barrel shifter are maskedout with exception to the desired PORTION bits 8015. Mask size 8017represents how many bits are to be masked out from the 128-bit stringreceived from barrel shifter 8009. In one example, the mask size isseven bits wide and represents 120-bits to be masked out of the 128-bitstring received from barrel shifter 8009. The result of the maskingoperation is 8-bit PORTION [0:7]. In another example, masking circuit8010 is an array of AND gates where mask size 8017 determines which bitsreceived from barrel shifter 8009 are anded with “0” and which bitsreceived from barrel shifter 8009 are anded with “1”. The PORTION bits8015 are then separated into two different bit groupings. In oneexample, the PORTION 8015 is an eight bit value that is separated into afirst two bit group PORTION [0:4] and a second six bit group PORTION[5:7]. In other examples, the hardware engine can select and utilizeportions with more than eight bits. Multiplying circuit 8022 receivesPORTION [5:7]. The output of multiplying circuit 8022 is the lookupblock offset value. The lookup block offset value indicates the offsetbetween the base address value and the first word of a specific lookupblock. The output of multiplying circuit 8022 is coupled to an input ofadding circuit 8012. PORTION [0:4] is received by word selector circuit8021. Word selector circuit 8021 receives PORTION [0:4] and outputs aword offset value 8024 and result location value 8026. Word offset value8024 indicates an offset between the first word within a lookup blockand a specified word within a lookup block. In one example, the wordoffset value may be a value between zero and six when each lookup blockcontains seven memory words. The word offset value 8024 output from wordselector circuit 8021 is coupled to another input of adding circuit8012. The result location value 8026 output from word selector circuit8021 is coupled to FIFO F2 the next stage (read stage 5050) of thepipeline 5043. A third input of adding circuit 8012 receives baseaddress value 8018. The output of adding circuit 8012 is a memoryaddress of the desired 128-bit word in memory 90. Memory address 8019 isincluded in read request 8006 (shown in FIG. 46). RESULT LOCATION [0:2]is communicated to the following stages of the pipeline and is utilizedwithin the lookup stage 5052. Request stage 5047 then issues a readrequest 8006 to memory controller 97 via FIFO 5048 and crossbar switch95. The memory controller 97 handles reading a single 128-bit word 8007from the memory location indicated by the read request 8006.

In one example, PORTION [0:7] output by masking circuit 2010 is a binaryvalue of 01010010. As show in FIG. 48, the five least significant bitsPORTION [0:4] (10010) are coupled to word selector circuit 8021. Thethree most significant bits PORTION [5:7] (101) are coupled tomultiplying circuit 8022. In one example, multiplying circuit 8022multiplies all inputs by a factor of seven and outputs the resultingvalue. The multiplier applied in multiplying circuit 8022 is the numberof words contained within a lookup block. Multiplying circuit 8022multiplies 101 (5 in decimal) and generates an output value 100011 (35in decimal). The output of multiplying circuit 8022 represents anaddress offset of the first memory word of the lookup block containingthe desired result field. Simultaneously, word selector circuit 8021determines that the binary value 10010 (18 in decimal) represents 24-bitresult number R18 and that result number R18 is located in the thirdmemory word position (“memory word 38”) within the lookup block (shownin FIG. 48). Word selector circuit 8021 then outputs a 3-bit word offsetvalue 8024 representing the third memory word position. In one example,the 3-bit word offset value 8024 representing the third memory wordposition is 011 (3 in decimal). Word selector circuit 8021 also outputsa 3-bit result location value 8026 indicating the result location(column shown in FIG. 47) in which the result number (R18) resides. Itis noted that in other examples additional result location values may beutilized to store more result values in a single word, and thatadditional result locations may require more than 3-bits to address theadditional result locations. Word selector circuit 8021 may beimplemented in various ways. In one example, word selector circuit 8021may implemented using a lookup table to generate a word offset value8024 and a result location value 8026. In another example, word selectorcircuit 8021 may be implemented using arithmetic logic that calculatesthe word offset value 8024 and the result location value 8026. The wordoffset value 8024 output from word selector circuit 8021 represents anaddress offset from the address of the first memory word in the lookupblock containing the desired result field. Adding circuit 8012 sums thelookup block offset value 8024 output from multiplying circuit 8022, theword offset value 8024 output from word selector circuit 8021, and thebase address 8018. Base address 8018 represents the memory address ofthe first word within the 24-bit lookup table. In one example, the baseaddress 8018 is zero. The output of adding circuit 8012 is the sum of 0,011 and 100011 which is 100110 (0+3+35=38 in decimal). Adding circuit8012 outputs the memory address 8019 of the word (“memory word 38”) inmemory containing the desired result field (R18 of lookup block #5 ashighlighted in FIG. 47).

As shown in FIG. 46, read stage 5050 of pipeline 5043 includes FIFO F2and ALU 2. In response to the read request 8006 send by request stage5047, read stage 5050 of the pipeline 5043 receives 128-bit word 8007from memory 90 via crossbar switch 96 and FIFO 5049. In one example, the128-bit word 8007 includes five 24-bit result values (“memory word #38”as shown in FIG. 47). Read stage 5050 also receives RESULT VALUE [0:2]8026 from the request stage 5047. Read stage 5050 then writes both the128-bit word 8007 and RESULT LOCATION [0:2] to register R1 5051 withinlookup stage 5052.

As shown in FIG. 46, pipeline 5043 includes register lookup stage 5052.Lookup stage 5052 of the pipeline is shown in greater detail in FIG. 49.Lookup stage 5052 includes register R1 5051 and ALU 3 5054. ALU 3 5054includes a multiplexing circuit 8011. In one example, multiplexingcircuit 8011 includes twenty-four one by five multiplexers. Multiplexingcircuit 8011 receives RESULT LOCATION [0:2] 8026 and the five 24-bitresult values from the 128-bit word 8007 received in read stage 5050.The multiplexing circuit 8011 selects one of the five 24-bit resultvalues based upon the value of RESULT LOCATION [0:2] 8026. The selected24-bit result value is then written to register R2 5063 of result stage5064. In one example, result value R18 from lookup block #5 (as shown inFIG. 47) is selected by multiplexing circuit 8011 and output to resultstage 5064. Result stage 5064 causes the selected result value (R18) tobe communicated to the initiating state machine.

FIG. 50 is a flowchart 8100 illustrating the direct 24-bit lookupoperation of lookup engine 74. Router receives an ethernet packet on aninput port (Step 8101). The ethernet packet includes a destination IPaddress. The ethernet packet is communicated to a microengine within therouter. The microengine sends a lookup command to the transactionalmemory (Step 8102). The lookup command includes a base address value, astarting bit position value, and a mask size value. The base addressvalue, starting bit position value, and mask size value are referred toas address information. The lookup command is received onto thetransactional memory via the CPP bus (Step 8103). In response toreceiving the lookup command, an idle state machine is selected toreceive the command by a state machine selector (Step 8104). In responseto receiving the lookup command, the selected state machine initiates apull across the CPP bus to read the input value (destination IP address)of the ethernet packet from the microengine (Step 8105). The input value(destination IP address) is then received onto the transactional memoryand stored in a register pool (Step 8106). The state machine then sendsan operation instruction to a translator that causes the translator tosend OP-CODES and address information to the pipeline (Step 8107). Therequest stage uses the input value (destination IP address) and theaddress information to determine a memory address. The request stage ofthe pipeline then issues a read request (including the memory address)to the memory unit to read a single 128-bit word (Step 8108). Thepipeline then receives the 128-bit word from the memory unit (Step8109). The lookup stage of the pipeline then selects one of five 24-bitresult values from 128-bit word in one clock cycle using combinationallogic (Step 8110). The result of the direct 24-bit lookup is a single24-bit result value. The 24-bit result value is communicated back to theinitiating state machine (Step 8111). The 24-bit result value is pushedback from the state machine to the microengine via the data businterface of the transactional memory and the CPP data bus (Step 8112).The router then outputs the ethernet packet onto an output portindicated by the 24-bit result value (Step 8113).

Op codes 6002 is supplied to each ALU in each state of the pipeline. Opcodes 6002 includes one operation code (op code) for each stage of thepipeline. Each operation code includes a plurality of bits. Theparticular combination of these bits indicates one of several differentoperation commands. The operation performed in each stage of thepipeline can be varied by changing the op code assigned to a givenpipeline stage. For example, the operation of the lookup stage of thepipeline 5043 can be changed from performing a direct 24-bit lookup to adirect 32-bit lookup. This allows flexible programming of each stage ofthe lookup engine 74 so that various lookup operations can be performedby the single lookup engine.

FIG. 33 shows the various hardware lookup blocks within lookup engine74. Only one output of the various hardware lookup blocks is utilizedduring a specific clock cycle. The contents stored in register R1 5051varies depending on which hardware lookup block is being utilized in thegiven clock cycle. Register R1 5051 is coupled to each hardware lookupblock. In one example, to reduce power consumption OP CODE is alsosupplied to each hardware lookup block and causes only one of thehardware lookup blocks to be turned on during a given clock cycle. Inanother example, OP CODE is only supplied to multiplexer 5062 and causesa single hardware lookup block output to be coupled the results stage.In one example, multiplexer circuit 5062 may be implemented utilizing aplurality of multiplexers. Three of the hardware lookup blocks(5055-50557) shown in FIG. 33 are direct lookup blocks. One of thehardware lookup blocks shown in FIG. 33 is a TCAM 32-bit lookup hardwareblock 5060.

FIG. 51 illustrates the values communicated in the lookup engine 74during a TCAM 32-bit lookup. In one example, upon receiving an ethernetpacket microengine 160 sends a lookup command 9400 to transactionalmemory 42, 52 via a CPP bus 159. In this example, the purpose of thelookup command 9400 is to determine what physical port and virtual portthe ethernet packet is to be routed to. The lookup command 9400 includesa memory address value. The lookup command 9400 may also include astarting bit position value and a mask size value. In another example,the mask size value is predetermined within the lookup engine 74 and notincluded in the lookup command 9400. The lookup command 9400 iscommunicated through the data bus interface 75 to state machine selector5032. State machine selector 5032 monitors the status indicator in eachstate machine within state machine array 5033 and routes lookup command9400 to idle state machine SM#1. In response to receiving lookup command9400, the selected state machine SM#1 issues a pull-id command to theinitiating microengine 160.

FIG. 32 is a state machine state diagram. The state machine transitionsfrom the idle state 5035 to the pull state 5036 when a lookup command9400 sent by microengine 160 is received by the state machine. The statemachine causes a pull-id bus transaction to be sent back to themicroengine 160 via data bus interface 75 and CPP bus 159. The format ofthe pull-id bus transaction is shown in FIG. 5. The DATA_REF fieldcontains the pull-id identifier that the microengine 160 provided in theoriginal lookup command 9400. The TARGET_REF field contains anidentifier supplied by the state machine target. This target_ref isusable by the target to identify later received data payloads with thepull-id. The starting address value and number of addresses to followvalue are also included in the pull-id bus transaction. The pull-id bustransaction is received by microengine 160 across the pull-id mesh. Fromthe DATA_REF field of the pull-id bus transaction, the microengine 160determines that the pull-id is associated with the original lookupcommand 9400 and that the microengine 160 should return to the target aninput value 9405. In one example, the input value 9405 is a destinationInternet Protocol (IP) address. The IP address 9405 is used by thelookup engine 74 to determine the destination (physical port and virtualport) to which the ethernet packet should be sent. Microengine 160therefore responds by sending one or more data bus transactions acrossthe data0 or data1 mesh to register pool 5038. Register pool 5038includes a controller and a plurality of registers. In one example, eachregister of the register pool 5038 is associated with an individualstate machine of the state machine array 5033. The format of the databus transactions is set forth in FIG. 6. The microengine 160 includesthe TARGET_REF identifier from the pull-id so that the receiving statemachine can associate the incoming data bus transactions with thepull-id. There may be one or more such data bus transactions. The LASTbit of a data bus transaction indicates whether there are more data bustransactions to follow, or whether the data bus transaction is the lastdata bus transaction for the pull-id. The DATA fields of these data bustransactions include the addresses where the count values are stored.

FIG. 52 illustrates how the TCAM 32-bit result values, reference values,and mask values are packed in memory 90. FIG. 52 illustrates oneembodiment wherein a first and a second word are both read out of memorytogether for a single lookup operation. The first memory word includes atype field, a starting position value, a mask value, multiple referencevalues, and multiple mask values. In one example, each reference valueand each mask value is eight bits wide. The second memory word includesfour result values. Each result value includes a final result bit. Inone example when the final result bit is equal to zero, the result valueis a final result and no further lookups are required. When the finalresult bit is equal to one, the result value is not a final andadditional lookup is required. Each memory word is 128 bits wide. Eachresult value is 32 bits wide. Each reference value is eight bits wide.Each mask value is eight bits wide. One skilled in the art willappreciate that the bit widths of the values listed above may beadjusted in various embodiments of the present invention.

Once all the pull data has been received and is stored in theappropriate register in register pool 5038, then the state machineoperation transitions from PULL state 5036 to OUTPUT state 5039. Thestate machine outputs an operation instruction 9401 to arbiter 5041.Once the output operation is complete, state machine operationtransitions from OUTPUT state 5039 to WAIT FOR RESULT state 5046. Duringthe WAIT FOR RESULT state 5046, the pipeline requests and reads two128-bit words 9407 from memory 90, selects one 32-bit result valuesincluded in the two received 128-bit words 9407, and returns theselected result value 9408 to the state machine (SM#1). FIG. 43illustrates an example of the different fields included in result value9408. The result value 9408 includes a final result field. In oneexample, the final result field is 1-bit wide. The result value 9408 hasa first set of fields when the result value 9408 is a final resultvalue. The result value 9408 has a second set of fields when the resultvalue 9408 is not a final result value. When the result value 9408 is afinal result value, 31 bits of the 32-bit result value is the desiredlookup result field. When the result value 9408 is not a final result,the result value includes a type of lookup field, a memory addressfield, a start bit position field, and a mask size field. If the finalresult field is set, a final result value has been found and the statemachine operation transitions from WAIT FOR RESULT state 5046 to IDLEstate 5035 and the result value 9408 is sent the ME. In one example, theresult value 9408 is a next hop output port identifier. If the finalresult field is not set, the final result value has not been found andthe state machine operation transitions from WAIT FOR RESULT state 5046to OUTPUT state 5039 and a subsequent lookup operation is performedbased upon the contents of the selected result value 9408. The arbiter5041 arbitrates information flow to translator 5042. Translator 5042receives the operation instruction and from the operation instructionoutputs new OP CODES 9402 and memory address 9403.

As shown in FIG. 51, pipeline 5043 includes request stage 5047. Requeststage 5047 includes FIFO F1 and Arithmetic Logic Unit (“ALU”) 1. In oneexample, the request stage of the pipeline supplies the state machinenumber to the register pool 5038. In another example, the read stage thepipeline supplies the state machine number to the register pool 5038.The register pool 5038 uses the state machine number to return to thepipeline the input value (IP address) 9405 stored in the register pool5038 for that state machine number. The request stage uses the memoryaddress to issue a read request 9406 to memory controller 97 FIFO 5048and crossbar switch 95. The memory controller 97 handles reading two128-bit words 9407 from the memory location indicated by the readrequest 9406.

FIG. 53 illustrates the circuitry of the lookup stage performing a TCAM32 bit lookup. The first and second word read from memory are stored inregister R1 5051. The input value is also stored in register R1 5051(“Storage Device”). In one example the input value is an IP address or apart thereof. Arithmetic logic unit (ALU 1) 5054 includes a selectingcircuit 9411, a selector value determining circuit 9413, and a resultvalue selection circuit 9415. First, selecting circuit 9411 receives thestarting bit position value 9416, the mask size value 9417, and the IPaddress 9405. In response, the selecting circuit 9411 outputs a portionof the input value (portion [0:7]) 9412. (The portion of the input valueis also referred to as the “lookup key value”) The selecting circuit9411 uses the starting bit position and mask size to select a PORTION9412 of the input value (IP address) 9405. In one example, the PORTION9412 is an eight bit portion of the input value (IP address) 9405. ThePORTION 9412 is selected by performing a barrel shift operation followedby a masking operation. The barrel shift operation is performed bybarrel shifter 9409. Barrel shifter 9409 receives the input value (IPaddress) 9405 and starting bit position 9416 and generates a shiftedversion of input value (IP address) 9405. A detailed circuit diagram ofthe barrel shifter 9409 is provided in FIG. 35. Description of thebarrel shifter operation is provided in the description of FIG. 35above. Mask circuit 9410 receives the shifted version of the input value(IP address) 9405 from barrel shifter 9409 and the mask size 9417 andperforms a masking operation whereby all bits received from the barrelshifter are masked out with exception to the desired PORTION bits 9412.Mask size 9417 represents how many bits are to be masked out from the128-bit string received from barrel shifter 9409. In one example, themask size is seven bits wide and represents 123 bits to be masked out ofthe 128-bit string received from barrel shifter 9409. The result of themasking operation is a five bit PORTION [0:4] 9412. In another example,masking circuit 9410 is an array of AND gates where mask size 9417determines which bits received from barrel shifter 9409 are anded with“0” and which bits received from barrel shifter 9409 are anded with “1”.In other examples, the hardware engine can select and utilize portionswith more or less than five. The portion of the input value 9412 is thelookup key value. The lookup key value is then communicated to thelookup key range identifier circuit 9413.

The selector value determining circuit 9413 includes a plurality ofmasking circuits (9418-9421), a plurality of comparator circuits(C0-C3), and a lookup table 9414. In one example, each masking circuitis an AND gate. Each masking circuit has two inputs. The first input isthe portion of the input value (lookup key value), and the second inputis a mask value (M0-M3). Each masking circuit outputs a masked value.The output of each masking circuit is coupled to a first input of acorresponding comparator circuit (C0-C3). A reference value (V0-V3) iscoupled to a second input of each comparator circuit (C0-C3). Eachcomparator circuit compares the masked value output by the correspondingmasking circuit with the reference value. Each comparator circuitoutputs a signal indicating if the reference value is equal to thecorresponding masking circuit output. In one example, each comparatorcircuit outputs a logic high signal if the reference value is equal tothe corresponding masking circuit output value. Alternatively, eachcomparator circuit outputs a logic low signal if the reference value isnot equal to the corresponding masking circuit output value. Lookuptable 9414 receives the output value from each comparator circuit(C0-C3). The lookup table and generates a three bit selector value 9422that is communicated to the result value selection circuit 9415. Thethree bit selector value 9422 represents which reference value matchesthe lookup key value masked by the corresponding mask value. The resultvalue selection circuit receives the selector value and selects one ofthe five result values (R0-R3 or default) and outputs the selectedresult value 9408. Result value selection circuit 9415 includes amultiplexing circuit 9423.

In other embodiments of the present invention, the number of resultvalues, reference values, and mask values within a word may vary.Likewise, the bit width of each memory word may vary.

FIG. 54 is a table illustrating the functionality of lookup table 9414shown in FIG. 53. The lookup table generates a selector value based uponthe multiple comparison values (TC0-TC 3). (“X” shown in FIG. 54represent don't care events)

In the event that the lookup key value masked by mask value M0 matchesreference value V0, the lookup table 9414 outputs a selector value thatwill cause result value selection circuit 9415 to select result valueR0. In this event the other comparison values (TC1-TC3) are ignored bylookup table 9414.

In the event that the lookup key value masked by mask value M0 does notmatch reference value V0, the lookup table 9414 will check if the lookupkey value masked by mask value M1 matches reference value V1. If thelookup key value masked by mask value M1 matches reference value V1, thelookup table 9414 outputs a selector value that will cause result valueselection circuit 9415 to select result value R1. In this event theremaining comparison values (TC2-TC3) are ignored by lookup table 9414.

In the event that the lookup key value masked by mask value M0 does notmatch reference value V0, and the lookup key value masked by mask valueM1 does not match reference value V1, the lookup table 9414 will checkif the lookup key value masked by mask value M2 matches reference valueV2. If the lookup key value masked by mask value M2 matches referencevalue V2, the lookup table 9414 outputs a selector value that will causeresult value selection circuit 9415 to select result value R2. In thisevent the remaining comparison value (TC3) is ignored by lookup table9414.

In the event that the lookup key value masked by mask value M0 does notmatch reference value V0, the lookup key value masked by mask value M1does not match reference value V1, and the lookup key value masked bymask value M2 does not match reference value V2, the lookup table 9414will check if the lookup key value masked by mask value M3 matchesreference value V3. If the lookup key value masked by mask value M3matches reference value V3, the lookup table 9414 outputs a selectorvalue that will cause result value selection circuit 9415 to selectresult value R3.

In the event that the lookup key value masked by mask value M0 does notmatch reference value V0, the lookup key value masked by mask value M1does not match reference value V1, the lookup key value masked by maskvalue M2 does not match reference value V2, and the lookup key valuemasked by mask value M3 does not match reference value V3, the lookuptable 9414 outputs a selector value that will cause result valueselection circuit 9415 to select the default result value (“DEFAULTVALUE”).

FIG. 55 is a flowchart 9500 illustrating the TCAM 32-bit lookupoperation of lookup engine 74. Router receives an ethernet packet on aninput port (Step 9501). The ethernet packet includes a destination IPaddress. The ethernet packet is communicated to a microengine within therouter. The microengine sends a lookup command to the transactionalmemory (Step 9502). The lookup command includes a memory address value.The lookup command is received onto the transactional memory via the CPPbus (Step 9503). In response to receiving the lookup command, an idlestate machine is selected to receive the command by a state machineselector (Step 9504). In response to receiving the lookup command, theselected state machine initiates a pull across the CPP bus to read theinput value (destination IP address) of the ethernet packet from themicroengine (Step 9405). The input value (destination IP address) isthen received onto the transactional memory and stored in a registerpool (Step 9506). The state machine then sends an operation instructionto a translator that causes the translator to send OP-CODES and addressinformation to the pipeline (Step 9507). The request stage of thepipeline then issues a read request based on the memory address value tothe memory unit to read two 128-bit words (Step 9508). The pipeline thenreceives two 128-bit words from the memory unit (Step 9509). The two 128bit words received from memory include a starting bit position value, amask size value, a plurality of result values, a plurality of referencevalues, and a plurality of mask values. The starting bit position valueand the mask size value are used to select a portion of the input value.The portion of the input value is the lookup key value. The lookup stageof the pipeline then selects one 32-bit result values from the two128-bit words using the lookup key value in one clock cycle usingcombinational logic (Step 9510). The result of the TCAM 32-bit lookup isa single 32-bit result value. The 32-bit result value is communicatedback to the initiating state machine (Step 9511). The 32-bit resultvalue is pushed back from the state machine to the microengine via thedata bus interface of the transactional memory and the CPP data bus(Step 9512). The router then outputs the ethernet packet onto an outputport indicated by the 32-bit result value (Step 9513).

Op codes 9402 is supplied to each ALU in each state of the pipeline. Opcodes 9401 includes one operation code (op code) for each stage of thepipeline. Each operation code includes a plurality of bits. Theparticular combination of these bits indicates one of several differentoperation commands. The operation performed in each stage of thepipeline can be varied by changing the op code assigned to a givenpipeline stage. For example, the operation of the lookup stage of thepipeline 5043 can be changed from performing a TCAM 32-bit lookup to aPMM 32-bit lookup. This allows flexible programming of each stage of thelookup engine 74 so that various lookup operations can be performed bythe single lookup engine.

FIG. 33 shows the various hardware lookup blocks within lookup engine74. Only one output of the various hardware lookup blocks is utilizedduring a specific clock cycle. The contents stored in register R1 5051varies depending on which hardware lookup block is being utilized in thegiven clock cycle. Register R1 5051 is coupled to each hardware lookupblock. In one example, to reduce power consumption OP CODE is alsosupplied to each hardware lookup block and causes only one of thehardware lookup blocks to be turned on during a given clock cycle. Inanother example, OP CODE is only supplied to multiplexer 5062 and causesa single hardware lookup block output to be coupled the results stage.In one example, multiplexer circuit 5062 may be implemented utilizing aplurality of multiplexers. Three of the hardware lookup blocks(5055-50557) shown in FIG. 33 are direct lookup blocks. One of thehardware lookup blocks shown in FIG. 33 is a Prefix Multiple Mask(“PMM”) 32-bit lookup hardware block 5059.

FIG. 56 illustrates the values communicated in the lookup engine 74during a PMM 32-bit lookup. In one example, upon receiving an ethernetpacket microengine 160 sends a lookup command 9600 to transactionalmemory 42, 52 via a CPP bus 159. In this example, the purpose of thelookup command 9600 is to determine what physical port and virtual portthe ethernet packet is to be routed to. The lookup command 9600 includesa memory address value. The lookup command 9600 is communicated throughthe data bus interface 75 to state machine selector 5032. State machineselector 5032 monitors the status indicator in each state machine withinstate machine array 5033 and routes lookup command 9600 to idle statemachine SM#1. In response to receiving lookup command 9600, the selectedstate machine SM#1 issues a pull-id command to the initiatingmicroengine 160.

FIG. 32 is a state machine state diagram. The state machine transitionsfrom the idle state 5035 to the pull state 5036 when a lookup command9600 sent by microengine 160 is received by the state machine. The statemachine causes a pull-id bus transaction to be sent back to themicroengine 160 via data bus interface 75 and CPP bus 159. The format ofthe pull-id bus transaction is shown in FIG. 5. The DATA_REF fieldcontains the pull-id identifier that the microengine 160 provided in theoriginal lookup command 9600. The TARGET_REF field contains anidentifier supplied by the state machine target. This target_ref isusable by the target to identify later received data payloads with thepull-id. The starting address value and number of addresses to followvalue are also included in the pull-id bus transaction. The pull-id bustransaction is received by microengine 160 across the pull-id mesh. Fromthe DATA_REF field of the pull-id bus transaction, the microengine 160determines that the pull-id is associated with the original lookupcommand 9600 and that the microengine 160 should return to the target aninput value 9605. In one example, the input value 9605 is a destinationInternet Protocol (IP) address. The IP address 9605 is used by thelookup engine 74 to determine the destination (physical port and virtualport) to which the ethernet packet should be sent. Microengine 160therefore responds by sending one or more data bus transactions acrossthe data0 or data1 mesh to register pool 5038. Register pool 5038includes a controller and a plurality of registers. In one example, eachregister of the register pool 5038 is associated with an individualstate machine of the state machine array 5033. The format of the databus transactions is set forth in FIG. 6. The microengine 160 includesthe TARGET_REF identifier from the pull-id so that the receiving statemachine can associate the incoming data bus transactions with thepull-id. There may be one or more such data bus transactions. The LASTbit of a data bus transaction indicates whether there are more data bustransactions to follow, or whether the data bus transaction is the lastdata bus transaction for the pull-id. The DATA fields of these data bustransactions include the addresses where the count values are stored.

FIG. 57 illustrates how the PMM 32-bit result values, reference value,and prefix values are packed in memory 90. FIG. 57 illustrates oneembodiment wherein a first and a second word are both read out of memorytogether for a single lookup operation. The first memory word includes atype field, a starting position value, a mask value, multiple referencevalues, and multiple prefix values. In one example, each reference valueis twelve bits wide and each prefix value is four bits wide. The secondmemory word includes four result values. Each result value includes afinal result bit. In one example when the final result bit is equal tozero, the result value is a final result and no further lookups arerequired. When the final result bit is equal to one, the result value isnot a final and additional lookup is required. Each memory word is 128bits wide. Each result value is 32 bits wide. Each reference value istwelve bits wide. Each prefix value is four bits wide. One skilled inthe art will appreciate that the bit widths of the values listed abovemay be adjusted in various embodiments of the present invention.

Once all the pull data has been received and is stored in theappropriate register in register pool 5038, then the state machineoperation transitions from PULL state 5036 to OUTPUT state 5039. Thestate machine outputs an operation instruction 9601 to arbiter 5041.Once the output operation is complete, state machine operationtransitions from OUTPUT state 5039 to WAIT FOR RESULT state 5046. Duringthe WAIT FOR RESULT state 5046, the pipeline requests and reads two128-bit words 9607 from memory 90, selects one 32-bit result valuesincluded in the two received 128-bit words 9607, and returns theselected result value 9608 to the state machine (SM#1). FIG. 43illustrates an example of the different fields included in result value9608. The result value 9608 includes a final result field. In oneexample, the final result field is 1-bit wide. The result value 9608 hasa first set of fields when the result value 9608 is a final resultvalue. The result value 9608 has a second set of fields when the resultvalue 9608 is not a final result value. When the result value 9608 is afinal result value, 31 bits of the 32-bit result value is the desiredlookup result field. When the result value 9608 is not a final result,the result value includes a type of lookup field and a memory addressfield. If the final result field is set, a final result value has beenfound and the state machine operation transitions from WAIT FOR RESULTstate 5046 to IDLE state 5035 and the result value 9608 is sent the ME.In one example, the result value 9608 is a next hop output portidentifier. If the final result field is not set, the final result valuehas not been found and the state machine operation transitions from WAITFOR RESULT state 5046 to OUTPUT state 5039 and a subsequent lookupoperation is performed based upon the contents of the selected resultvalue 9608. The arbiter 5041 arbitrates information flow to translator5042. Translator 5042 receives the operation instruction and from theoperation instruction outputs new OP CODES 9602 and memory address 9603.

As shown in FIG. 56, pipeline 5043 includes request stage 5047. Requeststage 5047 includes FIFO F1 and Arithmetic Logic Unit (“ALU”) 1. In oneexample, the request stage of the pipeline supplies the state machinenumber to the register pool 5038. In another example, the read stage thepipeline supplies the state machine number to the register pool 5038.The register pool 5038 uses the state machine number to return to thepipeline the input value (IP address) 9605 stored in the register pool5038 for that state machine number. The request stage uses the memoryaddress to issue a read request 9606 to memory controller 97 FIFO 5048and crossbar switch 95. The memory controller 97 handles reading two128-bit words 9607 from the memory location indicated by the readrequest 9606.

FIG. 59 illustrates the circuitry of the lookup stage performing a PMM32 bit lookup. The two words read from memory are stored in register R15051 (“Storage Device”). The input value is also stored in register R15051. In one example the input value is an IP address or a part thereof.Arithmetic logic unit (ALU 1) 5054 includes a selecting circuit 9611, aselector value determining circuit 9613, and a result value selectioncircuit 9615. First, selecting circuit 9611 receives the starting bitposition value 9616, the mask size value 9617, and the IP address 9605.In response, the selecting circuit 9611 outputs a portion of the inputvalue (portion[0:11]) 9612. The selecting circuit 9611 uses the startingbit position and mask size to select a PORTION 9612 of the input value(IP address) 9605. The selected portion of the input value 9612 is alsoreferred to as the “lookup key value”. In one example, the PORTION 9612is a twelve bit portion of the input value (IP address) 9605. ThePORTION 9612 is selected by performing a barrel shift operation followedby a masking operation. The barrel shift operation is performed bybarrel shifter 9609. Barrel shifter 9609 receives the input value (IPaddress) 9605 and starting bit position 9616 and generates a shiftedversion of input value (IP address) 9605. A detailed circuit diagram ofthe barrel shifter 9609 is provided in FIG. 35. Description of thebarrel shifter operation is provided in the description of FIG. 35above. Mask circuit 9610 receives the shifted version of the input value(IP address) 9605 from barrel shifter 9609 and the mask size 9617 andperforms a masking operation whereby all bits received from the barrelshifter are masked out with exception to the desired PORTION bits 9612.Mask size 9617 represents how many bits are to be masked out from the128-bit string received from barrel shifter 9609. In one example, themask size is seven bits wide and represents 123 bits to be masked out ofthe 128-bit string received from barrel shifter 9609. The result of themasking operation is a twelve bit PORTION [0:11] 9612. In anotherexample, masking circuit 9610 is an array of AND gates where mask size9617 determines which bits received from barrel shifter 9609 are andedwith “0” and which bits received from barrel shifter 9609 are anded with“1”. In other examples, the hardware engine can select and utilizeportions with more or less than twelve bits. The portion of the inputvalue 9612 is the lookup key value. The lookup key value is thencommunicated to the selector value determining circuit 9613.

The selector value determining circuit 9613 includes a plurality of maskvalue generators (G0-G3), a plurality of masking circuits (9618-9621), aplurality oflcomparator circuits (C0-C3), and a lookup table 9614. Inone example, each mask value generator is a lookup table and eachmasking circuit is an AND gate. In another example, each mask valuegenerator is a decoder circuit. Each mask value generator receives aprefix value and in response outputs a mask value (M0-M3). Each maskingcircuit has two inputs. The first input is the portion of the inputvalue (lookup key value), and the second input is a mask value output bya mask value generator (M0-M3). Each masking circuit outputs a maskedvalue. The output of each masking circuit is coupled to a first input ofa corresponding comparator circuit (C0-C3). A reference value (V0-V3) iscoupled to a second input of each comparator circuit (C0-C3). Eachcomparator circuit compares the masked value output by the correspondingmasking circuit with the reference value. Each comparator circuitoutputs a signal indicating if the reference value is equal to thecorresponding masking circuit output. In one example, each comparatorcircuit outputs a logic high signal if the reference value is equal tothe corresponding masking circuit output value. Alternatively, eachcomparator circuit outputs a logic low signal if the reference value isnot equal to the corresponding masking circuit output value. Lookuptable 9614 receives the output value from each comparator circuit(C0-C3). The lookup table and generates a three bit selector value 9622that is communicated to the result value selection circuit 9615. Thethree bit selector value 9622 represents which reference value matchesthe lookup key value masked by the corresponding mask value. The resultvalue selection circuit receives the selector value and selects one ofthe five result values (R0-R3 or default) and outputs the selectedresult value 9608. In one example, result value selection circuit 9615includes a multiplexing circuit 9623.

In other embodiments of the present invention, the number of resultvalues, reference values, and prefix values within a word may vary.Likewise, the bit width of each memory word may vary.

FIG. 60 is a table illustrating the functionality of mask valuegenerators (G0-G3) of FIG. 59. Each mask value generator outputs themask value shown in the right column when provided the correspondingprefix value shown in the left column. For example, when the prefixvalue is “0000” the mask value generator outputs a value of“000000000000”. One skilled in the art will appreciate that the numberof bits dedicated to defining the prefix value will control the numberof possible mask values the mask value generator can output.Accordingly, the number of bits dedicated to defining the prefix valuemay be adjusted to adjust the number of possible mask values generatedby the mask value generator.

FIG. 58 is a table illustrating the functionality of lookup table 9614shown in FIG. 57. The lookup table generates a selector value based uponthe multiple comparison values (TC0-TC 3). (“X” shown in FIG. 58represent don't care events)

In the event that the lookup key value masked by mask value M0 matchesreference value V0, the lookup table 9614 outputs a selector value thatwill cause result value selection circuit 9615 to select result valueR0. In this event the other comparison values (TC1-TC3) are ignored bylookup table 9614.

In the event that the lookup key value masked by mask value M0 does notmatch reference value V0, the lookup table 9614 will check if the lookupkey value masked by mask value M1 matches reference value V1. If thelookup key value masked by mask value M1 matches reference value V1, thelookup table 9614 outputs a selector value that will cause result valueselection circuit 9615 to select result value R1. In this event theremaining comparison values (TC2-TC3) are ignored by lookup table 9614.

In the event that the lookup key value masked by mask value M0 does notmatch reference value V0, and the lookup key value masked by mask valueM1 does not match reference value V1, the lookup table 9614 will checkif the lookup key value masked by mask value M2 matches reference valueV2. If the lookup key value masked by mask value M2 matches referencevalue V2, the lookup table 9614 outputs a selector value that will causeresult value selection circuit 9615 to select result value R2. In thisevent the remaining comparison value (TC3) is ignored by lookup table9614.

In the event that the lookup key value masked by mask value M0 does notmatch reference value V0, the lookup key value masked by mask value M1does not match reference value V1, and the lookup key value masked bymask value M2 does not match reference value V2, the lookup table 9614will check if the lookup key value masked by mask value M3 matchesreference value V3. If the lookup key value masked by mask value M3matches reference value V3, the lookup table 9614 outputs a selectorvalue that will cause result value selection circuit 9615 to selectresult value R3.

In the event that the lookup key value masked by mask value M0 does notmatch reference value V0, the lookup key value masked by mask value M1does not match reference value V1, the lookup key value masked by maskvalue M2 does not match reference value V2, and the lookup key valuemasked by mask value M3 does not match reference value V3, the lookuptable 9614 outputs a selector value that will cause result valueselection circuit 9615 to select the default result value (“DEFAULTVALUE”).

FIG. 61 is a flowchart 9700 illustrating the PMM 32-bit lookup operationof lookup engine 74. Router receives an ethernet packet on an input port(Step 9701). The ethernet packet includes a destination IP address. Theethernet packet is communicated to a microengine within the router. Themicroengine sends a lookup command to the transactional memory (Step9702). The lookup command includes a memory address value. The lookupcommand is received onto the transactional memory via the CPP bus (Step9703). In response to receiving the lookup command, an idle statemachine is selected to receive the command by a state machine selector(Step 9704). In response to receiving the lookup command, the selectedstate machine initiates a pull across the CPP bus to read the inputvalue (destination IP address) of the ethernet packet from themicroengine (Step 9705). The input value (destination IP address) isthen received onto the transactional memory and stored in a registerpool (Step 9706). The state machine then sends an operation instructionto a translator that causes the translator to send OP-CODES and addressinformation to the pipeline (Step 9707). The request stage of thepipeline then issues a read request based on the memory address value tothe memory unit to read two 128-bit words (Step 9708). The pipeline thenreceives two 128-bit words from the memory unit (Step 9709). The two 128bit words received from memory include a starting bit position value, amask size value, a plurality of result values, a plurality of referencevalues, and a plurality of prefix values. The starting bit positionvalue and the mask size value are used to select a portion of the inputvalue. The portion of the input value is the lookup key value. Thelookup stage of the pipeline then selects one 32-bit result values fromthe two 128-bit words using the lookup key value in one clock cycleusing combinational logic (Step 9710). The result of the PMM 32-bitlookup is a single 32-bit result value. The 32-bit result value iscommunicated back to the initiating state machine (Step 9711). The32-bit result value is pushed back from the state machine to themicroengine via the data bus interface of the transactional memory andthe CPP data bus (Step 9712). The router then outputs the ethernetpacket onto an output port indicated by the 32-bit result value (Step9713).

Op codes 9602 is supplied to each ALU in each state of the pipeline. Opcodes 9601 includes one operation code (op code) for each stage of thepipeline. Each operation code includes a plurality of bits. Theparticular combination of these bits indicates one of several differentoperation commands. The operation performed in each stage of thepipeline can be varied by changing the op code assigned to a givenpipeline stage. For example, the operation of the lookup stage of thepipeline 5043 can be changed from performing a PMM 32-bit lookup to aTCAM 32-bit lookup. This allows flexible programming of each stage ofthe lookup engine 74 so that various lookup operations can be performedby the single lookup engine.

Although certain specific embodiments are described above forinstructional purposes, the teachings of this patent document havegeneral applicability and are not limited to the specific embodimentsdescribed above. Accordingly, various modifications, adaptations, andcombinations of various features of the described embodiments can bepracticed without departing from the scope of the invention as set forthin the claims.

What is claimed is:
 1. A method comprising: (a) receiving a lookupcommand onto a transactional memory, wherein the lookup command includesa memory address, and wherein the transactional memory includes a lookupengine and a memory unit; (b) receiving an input value (IV); (c) usingthe memory address to read a word out of the memory unit, wherein theword includes a plurality of result values (RVs), a plurality ofreference values, and a plurality of mask values; (d) storing the RVs,the reference values, the mask values, and the IV into a storage devicein the lookup engine; (e) determining a lookup key value; (f)determining a selector value based at least in part on the lookup keyvalue; (g) selecting one of the plurality of RVs based on the selectorvalue determined in (f), wherein (b) through (g) are performed by thelookup engine.
 2. The method of claim 1, wherein the lookup key value isbased at least in part on a portion of the IV.
 3. The method of claim 1,wherein each reference value corresponds to a mask value.
 4. The methodof claim 1, wherein the determining of (e) is performed by a selectingcircuit that selects a portion of bits from the IV, and wherein theselecting circuit receives a starting bit position value, a mask sizevalue, and the input value and outputs the lookup key value.
 5. Themethod of claim 4, wherein the selecting circuit includes a barrelshifter and a mask circuit.
 6. The method of claim 1, wherein thedetermining of (f) is performed by a selector value determining circuit.7. The method of claim 6, wherein the selector value determining circuitincludes a masking circuit, a comparator circuit, and a lookup table. 8.The method of claim 1, wherein the selecting of (g) is performed by amultiplexing circuit.
 9. The method of claim 1, wherein the determiningof (f) further comprises: (f1) masking the lookup key value with theplurality of mask values thereby generating a plurality of maskedvalues; (f2) comparing the plurality of masked values with a referencevalue thereby generating a plurality of comparison values; and (f3)using the plurality of comparison values and a lookup table to determinethe selector value.
 10. The method of claim 1, wherein (e), (f), and (g)are performed by purely combinatorial logic.
 11. The method of claim 1,wherein the lookup command is received onto the transaction memory via abus, the method further comprising: (h) outputting the selected one ofthe plurality of RVs onto the bus.
 12. The method of claim 1, whereinthe input value (IV) of (b) is received onto the transactional memoryvia a bus in response to receiving the lookup command.
 13. The method ofclaim 11, wherein the bus is a command/push/pull (CPP) bus, and whereinthe transactional memory initiates a pull bus transaction and therebyreceives the IV via the bus.
 14. The method of claim 1, wherein the IVis at least part of an Internet Protocol (IP) destination address, andwherein the selected one of the plurality of RVs of (g) is a next hopoutput port identifier.
 15. The method of claim 1, wherein the storagedevice is taken from the group consisting of: a register, a plurality ofregisters.
 16. A transactional memory, comprising: a memory unit thatstores a plurality of result values (RVs), a plurality of referencevalues, and a plurality of mask values; a hardware lookup engine thatreads the plurality of RVs, the plurality of reference values, and theplurality of mask values from the memory unit, wherein a stage of thehardware lookup engine comprises: a storage device that stores theplurality of RVs, the plurality of reference values, the plurality ofmask values, and an input value (IV); a selecting circuit that selects aportion of the IV; a selector value determining circuit that determinesa selector value based on the portion of the IV, the plurality ofreference values, and the plurality of mask values; and a result valueselection circuit that selects the result value based on the selectorvalue.
 17. The transactional memory of claim 16, wherein the storagedevice is taken from the group consisting of: a register, a plurality ofregisters.
 18. The transactional memory of claim 16, wherein thehardware lookup engine involves no sequential logic elements.
 19. Thetransactional memory of claim 16, wherein the hardware lookup engineincludes no processor that fetches instructions.
 20. A circuitcomprising: a storage device that stores a plurality of result values(RVs), a plurality of reference values, a plurality of mask values, andan input value (IV); and means for: (1) receiving the plurality ofresult values, the plurality of reference values, the plurality of maskvalues, and the input value from the storage device, (2) selecting aportion of the IV, (3) determining a selector value, and (4) selectingone of the plurality of result values based on the selector value. 21.The circuit of claim 20, wherein the means for selecting a portion ofthe IV comprises a barrel shifter circuit and a mask circuit, whereinthe means for determining a selector value comprises a masking circuit,a comparator circuit, and a lookup table, and wherein the means forselecting a result value comprises a multiplexing circuit.
 22. Thecircuit of claim 20, wherein the storage device and the means are partsof a hardware lookup engine of a transactional memory.
 23. The circuitof claim 20, wherein the IV is an Internet Protocol (IP) destinationaddress.